{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import pandas as pd\n",
    "import numpy as np \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CG_LT_GL_GL04_FCokeRate</th>\n",
       "      <th>CG_LT_GL_GL04_FCoalRate</th>\n",
       "      <th>CG_LT_GL_GL04_RFWD</th>\n",
       "      <th>CG_LT_GL_GL04_FYLL</th>\n",
       "      <th>CG_LT_GL_GL04_LFLL</th>\n",
       "      <th>CG_LT_GL_GL04_GFDNKG</th>\n",
       "      <th>CG_LT_GL_GL04_RFH</th>\n",
       "      <th>CG_LT_GL_GL04_DW</th>\n",
       "      <th>CG_LT_GL_GL04_LDYL</th>\n",
       "      <th>CG_LT_GL_GL04_YC</th>\n",
       "      <th>...</th>\n",
       "      <th>CG_LT_GL_GL04_MQLYL</th>\n",
       "      <th>CG_LT_GL_GL04_ZXQL</th>\n",
       "      <th>CG_LT_GL_GL04_XBYCZB</th>\n",
       "      <th>CG_LT_GL_GL04_Ftswd</th>\n",
       "      <th>CG_LT_GL_GL04_19507WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_26275WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_34800WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_V</th>\n",
       "      <th>CG_LT_GL_GL04_Si_Ti</th>\n",
       "      <th>CG_LT_GL_GL04_Fliluntie</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>1.045600e+04</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.000000</td>\n",
       "      <td>10456.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>393.955910</td>\n",
       "      <td>125.942521</td>\n",
       "      <td>1145.256348</td>\n",
       "      <td>8908.563724</td>\n",
       "      <td>4707.936191</td>\n",
       "      <td>12707.168561</td>\n",
       "      <td>18056.933822</td>\n",
       "      <td>149.888262</td>\n",
       "      <td>219.372832</td>\n",
       "      <td>160.314388</td>\n",
       "      <td>...</td>\n",
       "      <td>47.181608</td>\n",
       "      <td>0.521425</td>\n",
       "      <td>-1.600038e+34</td>\n",
       "      <td>1464.537969</td>\n",
       "      <td>69.213910</td>\n",
       "      <td>116.103150</td>\n",
       "      <td>116.417495</td>\n",
       "      <td>0.233973</td>\n",
       "      <td>0.322410</td>\n",
       "      <td>243.30038</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>57.604321</td>\n",
       "      <td>37.490098</td>\n",
       "      <td>91.191420</td>\n",
       "      <td>4835.176402</td>\n",
       "      <td>1323.731634</td>\n",
       "      <td>4123.638494</td>\n",
       "      <td>8172.269263</td>\n",
       "      <td>47.318328</td>\n",
       "      <td>59.131173</td>\n",
       "      <td>39.427144</td>\n",
       "      <td>...</td>\n",
       "      <td>7.322514</td>\n",
       "      <td>0.115461</td>\n",
       "      <td>7.087776e+35</td>\n",
       "      <td>12.892058</td>\n",
       "      <td>11.283500</td>\n",
       "      <td>43.228280</td>\n",
       "      <td>41.319617</td>\n",
       "      <td>0.034262</td>\n",
       "      <td>0.199218</td>\n",
       "      <td>69.11228</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>673.409367</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>736.454243</td>\n",
       "      <td>47.903195</td>\n",
       "      <td>-1.329568</td>\n",
       "      <td>-0.703749</td>\n",
       "      <td>...</td>\n",
       "      <td>-4.837964</td>\n",
       "      <td>0.008458</td>\n",
       "      <td>-3.690000e+37</td>\n",
       "      <td>1169.000000</td>\n",
       "      <td>36.513460</td>\n",
       "      <td>34.713580</td>\n",
       "      <td>40.056458</td>\n",
       "      <td>0.132700</td>\n",
       "      <td>0.044000</td>\n",
       "      <td>0.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>365.000000</td>\n",
       "      <td>122.000000</td>\n",
       "      <td>1149.020474</td>\n",
       "      <td>5996.739770</td>\n",
       "      <td>4882.045863</td>\n",
       "      <td>12065.946218</td>\n",
       "      <td>14420.681675</td>\n",
       "      <td>114.822988</td>\n",
       "      <td>234.800064</td>\n",
       "      <td>163.689079</td>\n",
       "      <td>...</td>\n",
       "      <td>45.165451</td>\n",
       "      <td>0.486281</td>\n",
       "      <td>6.988125e+01</td>\n",
       "      <td>1457.000000</td>\n",
       "      <td>61.816906</td>\n",
       "      <td>85.717987</td>\n",
       "      <td>92.971564</td>\n",
       "      <td>0.196500</td>\n",
       "      <td>0.205500</td>\n",
       "      <td>228.40250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>382.000000</td>\n",
       "      <td>135.000000</td>\n",
       "      <td>1168.911240</td>\n",
       "      <td>10884.935990</td>\n",
       "      <td>5177.921941</td>\n",
       "      <td>13724.615695</td>\n",
       "      <td>18052.858560</td>\n",
       "      <td>145.110037</td>\n",
       "      <td>240.337796</td>\n",
       "      <td>172.310366</td>\n",
       "      <td>...</td>\n",
       "      <td>46.667947</td>\n",
       "      <td>0.545741</td>\n",
       "      <td>7.336741e+01</td>\n",
       "      <td>1465.000000</td>\n",
       "      <td>67.487732</td>\n",
       "      <td>111.067007</td>\n",
       "      <td>106.615957</td>\n",
       "      <td>0.232500</td>\n",
       "      <td>0.279700</td>\n",
       "      <td>261.08000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>411.250000</td>\n",
       "      <td>146.000000</td>\n",
       "      <td>1179.892570</td>\n",
       "      <td>12759.990980</td>\n",
       "      <td>5337.388711</td>\n",
       "      <td>14931.293367</td>\n",
       "      <td>23024.946070</td>\n",
       "      <td>177.604135</td>\n",
       "      <td>244.506590</td>\n",
       "      <td>175.782012</td>\n",
       "      <td>...</td>\n",
       "      <td>47.996656</td>\n",
       "      <td>0.591831</td>\n",
       "      <td>7.718561e+01</td>\n",
       "      <td>1472.000000</td>\n",
       "      <td>75.382416</td>\n",
       "      <td>144.830379</td>\n",
       "      <td>131.389463</td>\n",
       "      <td>0.261700</td>\n",
       "      <td>0.371000</td>\n",
       "      <td>284.46000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>669.000000</td>\n",
       "      <td>414.000000</td>\n",
       "      <td>1412.180433</td>\n",
       "      <td>17104.906650</td>\n",
       "      <td>5806.708636</td>\n",
       "      <td>77135.915760</td>\n",
       "      <td>87449.087710</td>\n",
       "      <td>1611.750031</td>\n",
       "      <td>250.387082</td>\n",
       "      <td>234.252728</td>\n",
       "      <td>...</td>\n",
       "      <td>336.064894</td>\n",
       "      <td>0.854358</td>\n",
       "      <td>2.442340e+05</td>\n",
       "      <td>1510.000000</td>\n",
       "      <td>149.593397</td>\n",
       "      <td>351.316543</td>\n",
       "      <td>303.618234</td>\n",
       "      <td>0.367800</td>\n",
       "      <td>1.962400</td>\n",
       "      <td>379.60000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       CG_LT_GL_GL04_FCokeRate  CG_LT_GL_GL04_FCoalRate  CG_LT_GL_GL04_RFWD  \\\n",
       "count             10456.000000             10456.000000        10456.000000   \n",
       "mean                393.955910               125.942521         1145.256348   \n",
       "std                  57.604321                37.490098           91.191420   \n",
       "min                   0.000000                 0.000000          673.409367   \n",
       "25%                 365.000000               122.000000         1149.020474   \n",
       "50%                 382.000000               135.000000         1168.911240   \n",
       "75%                 411.250000               146.000000         1179.892570   \n",
       "max                 669.000000               414.000000         1412.180433   \n",
       "\n",
       "       CG_LT_GL_GL04_FYLL  CG_LT_GL_GL04_LFLL  CG_LT_GL_GL04_GFDNKG  \\\n",
       "count        10456.000000        10456.000000          10456.000000   \n",
       "mean          8908.563724         4707.936191          12707.168561   \n",
       "std           4835.176402         1323.731634           4123.638494   \n",
       "min              0.000000            0.000000              0.000000   \n",
       "25%           5996.739770         4882.045863          12065.946218   \n",
       "50%          10884.935990         5177.921941          13724.615695   \n",
       "75%          12759.990980         5337.388711          14931.293367   \n",
       "max          17104.906650         5806.708636          77135.915760   \n",
       "\n",
       "       CG_LT_GL_GL04_RFH  CG_LT_GL_GL04_DW  CG_LT_GL_GL04_LDYL  \\\n",
       "count       10456.000000      10456.000000        10456.000000   \n",
       "mean        18056.933822        149.888262          219.372832   \n",
       "std          8172.269263         47.318328           59.131173   \n",
       "min           736.454243         47.903195           -1.329568   \n",
       "25%         14420.681675        114.822988          234.800064   \n",
       "50%         18052.858560        145.110037          240.337796   \n",
       "75%         23024.946070        177.604135          244.506590   \n",
       "max         87449.087710       1611.750031          250.387082   \n",
       "\n",
       "       CG_LT_GL_GL04_YC  ...  CG_LT_GL_GL04_MQLYL  CG_LT_GL_GL04_ZXQL  \\\n",
       "count      10456.000000  ...         10456.000000        10456.000000   \n",
       "mean         160.314388  ...            47.181608            0.521425   \n",
       "std           39.427144  ...             7.322514            0.115461   \n",
       "min           -0.703749  ...            -4.837964            0.008458   \n",
       "25%          163.689079  ...            45.165451            0.486281   \n",
       "50%          172.310366  ...            46.667947            0.545741   \n",
       "75%          175.782012  ...            47.996656            0.591831   \n",
       "max          234.252728  ...           336.064894            0.854358   \n",
       "\n",
       "       CG_LT_GL_GL04_XBYCZB  CG_LT_GL_GL04_Ftswd  CG_LT_GL_GL04_19507WDPJ  \\\n",
       "count          1.045600e+04         10456.000000             10456.000000   \n",
       "mean          -1.600038e+34          1464.537969                69.213910   \n",
       "std            7.087776e+35            12.892058                11.283500   \n",
       "min           -3.690000e+37          1169.000000                36.513460   \n",
       "25%            6.988125e+01          1457.000000                61.816906   \n",
       "50%            7.336741e+01          1465.000000                67.487732   \n",
       "75%            7.718561e+01          1472.000000                75.382416   \n",
       "max            2.442340e+05          1510.000000               149.593397   \n",
       "\n",
       "       CG_LT_GL_GL04_26275WDPJ  CG_LT_GL_GL04_34800WDPJ  CG_LT_GL_GL04_V  \\\n",
       "count             10456.000000             10456.000000     10456.000000   \n",
       "mean                116.103150               116.417495         0.233973   \n",
       "std                  43.228280                41.319617         0.034262   \n",
       "min                  34.713580                40.056458         0.132700   \n",
       "25%                  85.717987                92.971564         0.196500   \n",
       "50%                 111.067007               106.615957         0.232500   \n",
       "75%                 144.830379               131.389463         0.261700   \n",
       "max                 351.316543               303.618234         0.367800   \n",
       "\n",
       "       CG_LT_GL_GL04_Si_Ti  CG_LT_GL_GL04_Fliluntie  \n",
       "count         10456.000000              10456.00000  \n",
       "mean              0.322410                243.30038  \n",
       "std               0.199218                 69.11228  \n",
       "min               0.044000                  0.00000  \n",
       "25%               0.205500                228.40250  \n",
       "50%               0.279700                261.08000  \n",
       "75%               0.371000                284.46000  \n",
       "max               1.962400                379.60000  \n",
       "\n",
       "[8 rows x 21 columns]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = 'C:\\\\Users\\\\sijin\\\\Desktop\\\\打分更新2020\\\\20220707\\\\Dafen_20220708.csv'\n",
    "df = pd.read_csv(data,encoding = 'gb18030')\n",
    "\n",
    "# 关键指标 和 类型\n",
    "# 递减指标（RLB、Ftswd、Si_Ti）\n",
    "# 递增指标（Fliluntie、V）\n",
    "    \n",
    "key_dict = dict( ###操作参数\n",
    "               CG_LT_GL_GL04_FCokeRate='Asc',\n",
    "               CG_LT_GL_GL04_FCoalRate='Asc', \n",
    "               CG_LT_GL_GL04_RFWD='Asc',\n",
    "               CG_LT_GL_GL04_FYLL= 'Asc',\n",
    "               CG_LT_GL_GL04_LFLL= 'Asc', \n",
    "               CG_LT_GL_GL04_GFDNKG= 'Asc',\n",
    "               CG_LT_GL_GL04_RFH='Desc',\n",
    "    ###状态参数\n",
    "               CG_LT_GL_GL04_DW='Desc',\n",
    "               CG_LT_GL_GL04_LDYL='Desc', \n",
    "               CG_LT_GL_GL04_YC='Desc',\n",
    "               CG_LT_GL_GL04_TQXZS= 'Asc',\n",
    "               CG_LT_GL_GL04_MQLYL= 'Asc',\n",
    "               CG_LT_GL_GL04_ZXQL='Asc',\n",
    "               CG_LT_GL_GL04_XBYCZB= 'Desc',\n",
    "               CG_LT_GL_GL04_Ftswd= 'Desc',\n",
    "               CG_LT_GL_GL04_19507WDPJ='Desc',\n",
    "               CG_LT_GL_GL04_26275WDPJ='Desc',\n",
    "               CG_LT_GL_GL04_34800WDPJ= 'Desc',\n",
    "     ######经济指标\n",
    "               CG_LT_GL_GL04_V='Asc', \n",
    "               CG_LT_GL_GL04_Si_Ti='Desc',\n",
    "               #CG_LT_GL_GL04_FCoalRate= 'Asc',\n",
    "               #CG_LT_GL_GL04_FCokeRate= 'Desc',\n",
    "               CG_LT_GL_GL04_Fliluntie='Asc')\n",
    "\n",
    "key_params = key_dict.keys()\n",
    "\n",
    "\n",
    "#原始数据分析结果\n",
    "df[key_params].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'CG_LT_GL_GL04_FCokeRate': {'lower_bound': 295.625, 'upper_bound': 480.625, 'Q1': 365.0, 'Q2': 382.0, 'Q3': 411.25}, 'CG_LT_GL_GL04_FCoalRate': {'lower_bound': 86.0, 'upper_bound': 182.0, 'Q1': 122.0, 'Q2': 135.0, 'Q3': 146.0}, 'CG_LT_GL_GL04_RFWD': {'lower_bound': 1102.7123299999998, 'upper_bound': 1226.200714, 'Q1': 1149.020474, 'Q2': 1168.9112395000002, 'Q3': 1179.89257}, 'CG_LT_GL_GL04_FYLL': {'lower_bound': -4148.137045624999, 'upper_bound': 22904.867795374998, 'Q1': 5996.73976975, 'Q2': 10884.93599, 'Q3': 12759.990979999999}, 'CG_LT_GL_GL04_LFLL': {'lower_bound': 4199.031589625001, 'upper_bound': 6020.402984625, 'Q1': 4882.04586275, 'Q2': 5177.921941, 'Q3': 5337.3887115}, 'CG_LT_GL_GL04_GFDNKG': {'lower_bound': 7767.925492500004, 'upper_bound': 19229.314092499997, 'Q1': 12065.9462175, 'Q2': 13724.615695, 'Q3': 14931.293367499999}, 'CG_LT_GL_GL04_RFH': {'lower_bound': 1514.2850825000023, 'upper_bound': 35931.3426625, 'Q1': 14420.681675, 'Q2': 18052.85856, 'Q3': 23024.946069999998}, 'CG_LT_GL_GL04_DW': {'lower_bound': 20.651267100000013, 'upper_bound': 271.77585550000003, 'Q1': 114.82298775000001, 'Q2': 145.1100374, 'Q3': 177.60413485}, 'CG_LT_GL_GL04_LDYL': {'lower_bound': 220.240276, 'upper_bound': 259.066378, 'Q1': 234.80006425, 'Q2': 240.337796, 'Q3': 244.50658975}, 'CG_LT_GL_GL04_YC': {'lower_bound': 145.54967887499998, 'upper_bound': 193.92141187500005, 'Q1': 163.68907875, 'Q2': 172.3103665, 'Q3': 175.782012}, 'CG_LT_GL_GL04_TQXZS': {'lower_bound': 24.181435124999997, 'upper_bound': 35.479962125, 'Q1': 28.41838275, 'Q2': 29.8512785, 'Q3': 31.2430145}, 'CG_LT_GL_GL04_MQLYL': {'lower_bound': 40.91864312499999, 'upper_bound': 52.243464125, 'Q1': 45.165451, 'Q2': 46.667947, 'Q3': 47.99665625}, 'CG_LT_GL_GL04_ZXQL': {'lower_bound': 0.32795525, 'upper_bound': 0.75015725, 'Q1': 0.48628099999999996, 'Q2': 0.5457415, 'Q3': 0.5918315}, 'CG_LT_GL_GL04_XBYCZB': {'lower_bound': 58.924718249999984, 'upper_bound': 88.14214625000002, 'Q1': 69.88125375, 'Q2': 73.367407, 'Q3': 77.18561075000001}, 'CG_LT_GL_GL04_Ftswd': {'lower_bound': 1434.5, 'upper_bound': 1494.5, 'Q1': 1457.0, 'Q2': 1465.0, 'Q3': 1472.0}, 'CG_LT_GL_GL04_19507WDPJ': {'lower_bound': 41.468641125, 'upper_bound': 95.73068012500002, 'Q1': 61.816905750000004, 'Q2': 67.48773249999999, 'Q3': 75.38241550000001}, 'CG_LT_GL_GL04_26275WDPJ': {'lower_bound': -2.9505993750000528, 'upper_bound': 233.49896562500007, 'Q1': 85.71798749999999, 'Q2': 111.06700699999999, 'Q3': 144.83037875000002}, 'CG_LT_GL_GL04_34800WDPJ': {'lower_bound': 35.34471612500003, 'upper_bound': 189.01631112499996, 'Q1': 92.97156425, 'Q2': 106.61595700000001, 'Q3': 131.38946299999998}, 'CG_LT_GL_GL04_V': {'lower_bound': 0.09870000000000004, 'upper_bound': 0.35949999999999993, 'Q1': 0.1965, 'Q2': 0.2325, 'Q3': 0.2617}, 'CG_LT_GL_GL04_Si_Ti': {'lower_bound': -0.04275000000000004, 'upper_bound': 0.6192500000000001, 'Q1': 0.2055, 'Q2': 0.2797, 'Q3': 0.371}, 'CG_LT_GL_GL04_Fliluntie': {'lower_bound': 144.31624999999997, 'upper_bound': 368.54625, 'Q1': 228.40249999999997, 'Q2': 261.08000000000004, 'Q3': 284.46}}\n"
     ]
    }
   ],
   "source": [
    "#四分卫距算法\n",
    "def outlier_treatment(df, cols, whis=1.5):\n",
    "    range_map = {}\n",
    "    for col in cols:\n",
    "        Q1,Q2,Q3,Q5,Q95 = df[col].quantile([0.25,0.50,0.75,0.05,0.95])\n",
    "        IQR = Q3 - Q1\n",
    "        range_map[col] = {}\n",
    "        range_map[col]['lower_bound'] = Q1 -(whis * IQR)\n",
    "        range_map[col]['upper_bound'] = Q3 + (whis * IQR)\n",
    "        range_map[col]['Q1'] = Q1\n",
    "        range_map[col]['Q2'] = Q2\n",
    "        range_map[col]['Q3'] = Q3\n",
    "#        range_map[col]['Q5'] = Q5\n",
    " #       range_map[col]['Q95'] = Q95\n",
    "    return range_map\n",
    "\n",
    "#原始数据四分卫距统计表\n",
    "analysis_map = outlier_treatment(df, key_params)\n",
    "print(analysis_map)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "metadata": {},
   "outputs": [],
   "source": [
    "#人工经验指标范围\n",
    "exp_map = {\n",
    "    \n",
    "    ####操作指标\n",
    "    \"CG_LT_GL_GL04_FCokeRate\": {\n",
    "        \"lower_bound\": 350,\n",
    "        \"upper_bound\": 480\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_FCoalRate\":{\n",
    "        \"lower_bound\": 120,\n",
    "        \"upper_bound\": 150\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_RFWD\":{\n",
    "        \"lower_bound\": 1150,\n",
    "        \"upper_bound\": 1209\n",
    "    },    \n",
    "    \"CG_LT_GL_GL04_FYLL\":{\n",
    "        \"lower_bound\": 9500,\n",
    "        \"upper_bound\": 15500\n",
    "    },  \n",
    "     \"CG_LT_GL_GL04_LFLL\":{\n",
    "        \"lower_bound\": 4800,\n",
    "        \"upper_bound\": 5500\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_GFDNKG\":{\n",
    "        \"lower_bound\": 10000,\n",
    "        \"upper_bound\": 13500\n",
    "    },    \n",
    "    \"CG_LT_GL_GL04_RFH\":{\n",
    "        \"lower_bound\": 10000,\n",
    "        \"upper_bound\": 27000\n",
    "    },\n",
    "####状态指标\n",
    "    \"CG_LT_GL_GL04_DW\": {\n",
    "        \"lower_bound\": 140,\n",
    "        \"upper_bound\": 230\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_Ftswd\":{\n",
    "        \"lower_bound\": 1450,\n",
    "        \"upper_bound\": 1490\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_LDYL\":{\n",
    "        \"lower_bound\": 220,\n",
    "        \"upper_bound\": 255\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_YC\":{\n",
    "        \"lower_bound\": 160,\n",
    "        \"upper_bound\": 190\n",
    "    },    \n",
    "    \"CG_LT_GL_GL04_TQXZS\":{\n",
    "        \"lower_bound\": 27.5,\n",
    "        \"upper_bound\": 32.5\n",
    "    },    \n",
    "    \"CG_LT_GL_GL04_MQLYL\":{\n",
    "        \"lower_bound\": 44,\n",
    "        \"upper_bound\": 47.5\n",
    "    },    \n",
    "    \"CG_LT_GL_GL04_ZXQL\":{\n",
    "        \"lower_bound\": 0.46,\n",
    "        \"upper_bound\": 0.66\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_XBYCZB\":{\n",
    "        \"lower_bound\": 65,\n",
    "        \"upper_bound\": 80\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_19507WDPJ\":{\n",
    "        \"lower_bound\": 55,\n",
    "        \"upper_bound\": 95\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_26275WDPJ\":{\n",
    "        \"lower_bound\": 70,\n",
    "        \"upper_bound\": 100\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_34800WDPJ\":{\n",
    "        \"lower_bound\": 85,\n",
    "        \"upper_bound\": 125\n",
    "    },\n",
    "#####经济指标\n",
    "     \"CG_LT_GL_GL04_V\":{\n",
    "        \"lower_bound\": 0.15,\n",
    "        \"upper_bound\": 0.26\n",
    "    },\n",
    "    \"CG_LT_GL_GL04_Si_Ti\":{\n",
    "        \"lower_bound\": 0.15,\n",
    "        \"upper_bound\": 0.5\n",
    "    },    \n",
    "    #\"CG_LT_GL_GL04_FCoalRate\":{\n",
    "     #   \"lower_bound\": 125,\n",
    "     #   \"upper_bound\": 160\n",
    "   # },    \n",
    "    #\"CG_LT_GL_GL04_FCokeRate\":{\n",
    "     #   \"lower_bound\": 350,\n",
    "     #   \"upper_bound\": 382\n",
    "   # },    \n",
    "    \"CG_LT_GL_GL04_Fliluntie\":{\n",
    "        \"lower_bound\": 240,\n",
    "        \"upper_bound\": 280\n",
    "    }\n",
    "\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'CG_LT_GL_GL04_FCokeRate': {'lower_bound': 350, 'upper_bound': 480}, 'CG_LT_GL_GL04_FCoalRate': {'lower_bound': 120, 'upper_bound': 150}, 'CG_LT_GL_GL04_RFWD': {'lower_bound': 1160, 'upper_bound': 1190}, 'CG_LT_GL_GL04_FYLL': {'lower_bound': 10000, 'upper_bound': 15500}, 'CG_LT_GL_GL04_LFLL': {'lower_bound': 4800, 'upper_bound': 5500}, 'CG_LT_GL_GL04_GFDNKG': {'lower_bound': 10000, 'upper_bound': 13500}, 'CG_LT_GL_GL04_RFH': {'lower_bound': 10000, 'upper_bound': 27000}, 'CG_LT_GL_GL04_DW': {'lower_bound': 140, 'upper_bound': 230}, 'CG_LT_GL_GL04_LDYL': {'lower_bound': 220.240276, 'upper_bound': 255}, 'CG_LT_GL_GL04_YC': {'lower_bound': 160, 'upper_bound': 190}, 'CG_LT_GL_GL04_TQXZS': {'lower_bound': 27.5, 'upper_bound': 32.5}, 'CG_LT_GL_GL04_MQLYL': {'lower_bound': 44, 'upper_bound': 47.5}, 'CG_LT_GL_GL04_ZXQL': {'lower_bound': 0.46, 'upper_bound': 0.66}, 'CG_LT_GL_GL04_XBYCZB': {'lower_bound': 65, 'upper_bound': 80}, 'CG_LT_GL_GL04_Ftswd': {'lower_bound': 1450, 'upper_bound': 1490}, 'CG_LT_GL_GL04_19507WDPJ': {'lower_bound': 55, 'upper_bound': 95}, 'CG_LT_GL_GL04_26275WDPJ': {'lower_bound': 70, 'upper_bound': 100}, 'CG_LT_GL_GL04_34800WDPJ': {'lower_bound': 85, 'upper_bound': 125}, 'CG_LT_GL_GL04_V': {'lower_bound': 0.15, 'upper_bound': 0.26}, 'CG_LT_GL_GL04_Si_Ti': {'lower_bound': 0.15, 'upper_bound': 0.5}, 'CG_LT_GL_GL04_Fliluntie': {'lower_bound': 240, 'upper_bound': 280}}\n"
     ]
    }
   ],
   "source": [
    "#最终指标范围表生成\n",
    "#结合统计表和人工经验表\n",
    "final_map = {}\n",
    "for param in key_params:\n",
    "    cnt = analysis_map[param]\n",
    "    final_map[param] = {}\n",
    "    final_map[param]['lower_bound'] = analysis_map[param]['lower_bound'] \\\n",
    "        if analysis_map[param]['lower_bound'] >= exp_map[param]['lower_bound'] \\\n",
    "        else exp_map[param]['lower_bound']\n",
    "    final_map[param]['upper_bound'] = analysis_map[param]['upper_bound'] \\\n",
    "        if analysis_map[param]['upper_bound'] <= exp_map[param]['upper_bound'] \\\n",
    "        else exp_map[param]['upper_bound']    \n",
    "\n",
    "#最终范围表\n",
    "print(final_map)   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {},
   "outputs": [],
   "source": [
    "#计算百分位数函数\n",
    "#注意，取值范围为0.01 - 0.99，非剔除的异常状态，都是高于60分 小于99分的数值\n",
    "#60为标记的异常状态，区分于正常打分空间\n",
    "def calculate_quantile(df):\n",
    "    df_quantile = pd.DataFrame()\n",
    "    for i in range(1, 100):\n",
    "        df_quantile = df_quantile.append(df.quantile(i / 100))\n",
    "    return df_quantile"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CG_LT_GL_GL04_FCokeRate</th>\n",
       "      <th>CG_LT_GL_GL04_FCoalRate</th>\n",
       "      <th>CG_LT_GL_GL04_RFWD</th>\n",
       "      <th>CG_LT_GL_GL04_FYLL</th>\n",
       "      <th>CG_LT_GL_GL04_LFLL</th>\n",
       "      <th>CG_LT_GL_GL04_GFDNKG</th>\n",
       "      <th>CG_LT_GL_GL04_RFH</th>\n",
       "      <th>CG_LT_GL_GL04_DW</th>\n",
       "      <th>CG_LT_GL_GL04_LDYL</th>\n",
       "      <th>CG_LT_GL_GL04_YC</th>\n",
       "      <th>...</th>\n",
       "      <th>CG_LT_GL_GL04_ZXQL</th>\n",
       "      <th>CG_LT_GL_GL04_XBYCZB</th>\n",
       "      <th>CG_LT_GL_GL04_Ftswd</th>\n",
       "      <th>CG_LT_GL_GL04_19507WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_26275WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_34800WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_V</th>\n",
       "      <th>CG_LT_GL_GL04_Si_Ti</th>\n",
       "      <th>CG_LT_GL_GL04_Fliluntie</th>\n",
       "      <th>perc</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0.01</th>\n",
       "      <td>350.0</td>\n",
       "      <td>120.0</td>\n",
       "      <td>1160.40</td>\n",
       "      <td>10003.17</td>\n",
       "      <td>4818.69</td>\n",
       "      <td>10127.17</td>\n",
       "      <td>11240.44</td>\n",
       "      <td>140.58</td>\n",
       "      <td>225.30</td>\n",
       "      <td>160.43</td>\n",
       "      <td>...</td>\n",
       "      <td>0.46</td>\n",
       "      <td>65.45</td>\n",
       "      <td>1450.0</td>\n",
       "      <td>56.01</td>\n",
       "      <td>71.30</td>\n",
       "      <td>85.52</td>\n",
       "      <td>0.17</td>\n",
       "      <td>0.16</td>\n",
       "      <td>240.42</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.02</th>\n",
       "      <td>351.0</td>\n",
       "      <td>121.0</td>\n",
       "      <td>1161.57</td>\n",
       "      <td>10006.45</td>\n",
       "      <td>4834.09</td>\n",
       "      <td>10265.96</td>\n",
       "      <td>11930.40</td>\n",
       "      <td>141.13</td>\n",
       "      <td>227.59</td>\n",
       "      <td>160.77</td>\n",
       "      <td>...</td>\n",
       "      <td>0.47</td>\n",
       "      <td>65.82</td>\n",
       "      <td>1450.0</td>\n",
       "      <td>56.76</td>\n",
       "      <td>72.70</td>\n",
       "      <td>85.93</td>\n",
       "      <td>0.18</td>\n",
       "      <td>0.16</td>\n",
       "      <td>240.66</td>\n",
       "      <td>0.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.03</th>\n",
       "      <td>351.0</td>\n",
       "      <td>121.0</td>\n",
       "      <td>1162.93</td>\n",
       "      <td>10012.12</td>\n",
       "      <td>4851.97</td>\n",
       "      <td>10337.50</td>\n",
       "      <td>12345.03</td>\n",
       "      <td>141.74</td>\n",
       "      <td>228.83</td>\n",
       "      <td>161.15</td>\n",
       "      <td>...</td>\n",
       "      <td>0.47</td>\n",
       "      <td>66.25</td>\n",
       "      <td>1450.0</td>\n",
       "      <td>57.34</td>\n",
       "      <td>74.21</td>\n",
       "      <td>86.29</td>\n",
       "      <td>0.18</td>\n",
       "      <td>0.17</td>\n",
       "      <td>241.02</td>\n",
       "      <td>0.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.04</th>\n",
       "      <td>351.0</td>\n",
       "      <td>122.0</td>\n",
       "      <td>1163.91</td>\n",
       "      <td>10059.05</td>\n",
       "      <td>4867.69</td>\n",
       "      <td>10430.54</td>\n",
       "      <td>12581.28</td>\n",
       "      <td>142.32</td>\n",
       "      <td>229.74</td>\n",
       "      <td>161.53</td>\n",
       "      <td>...</td>\n",
       "      <td>0.47</td>\n",
       "      <td>66.59</td>\n",
       "      <td>1450.0</td>\n",
       "      <td>57.71</td>\n",
       "      <td>74.99</td>\n",
       "      <td>86.87</td>\n",
       "      <td>0.19</td>\n",
       "      <td>0.18</td>\n",
       "      <td>241.08</td>\n",
       "      <td>0.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.05</th>\n",
       "      <td>352.0</td>\n",
       "      <td>123.0</td>\n",
       "      <td>1164.42</td>\n",
       "      <td>10189.04</td>\n",
       "      <td>4884.61</td>\n",
       "      <td>10493.61</td>\n",
       "      <td>12864.26</td>\n",
       "      <td>142.83</td>\n",
       "      <td>230.33</td>\n",
       "      <td>161.91</td>\n",
       "      <td>...</td>\n",
       "      <td>0.48</td>\n",
       "      <td>66.90</td>\n",
       "      <td>1450.0</td>\n",
       "      <td>58.03</td>\n",
       "      <td>75.99</td>\n",
       "      <td>87.31</td>\n",
       "      <td>0.19</td>\n",
       "      <td>0.18</td>\n",
       "      <td>241.14</td>\n",
       "      <td>0.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.95</th>\n",
       "      <td>452.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1184.75</td>\n",
       "      <td>14488.90</td>\n",
       "      <td>5444.65</td>\n",
       "      <td>13404.73</td>\n",
       "      <td>25940.98</td>\n",
       "      <td>218.84</td>\n",
       "      <td>245.41</td>\n",
       "      <td>180.39</td>\n",
       "      <td>...</td>\n",
       "      <td>0.64</td>\n",
       "      <td>79.04</td>\n",
       "      <td>1485.0</td>\n",
       "      <td>86.36</td>\n",
       "      <td>97.84</td>\n",
       "      <td>121.10</td>\n",
       "      <td>0.26</td>\n",
       "      <td>0.40</td>\n",
       "      <td>278.88</td>\n",
       "      <td>0.95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.96</th>\n",
       "      <td>460.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1185.33</td>\n",
       "      <td>14765.18</td>\n",
       "      <td>5454.04</td>\n",
       "      <td>13421.27</td>\n",
       "      <td>25960.04</td>\n",
       "      <td>220.90</td>\n",
       "      <td>245.48</td>\n",
       "      <td>180.73</td>\n",
       "      <td>...</td>\n",
       "      <td>0.64</td>\n",
       "      <td>79.23</td>\n",
       "      <td>1485.0</td>\n",
       "      <td>87.64</td>\n",
       "      <td>98.19</td>\n",
       "      <td>121.78</td>\n",
       "      <td>0.26</td>\n",
       "      <td>0.41</td>\n",
       "      <td>279.24</td>\n",
       "      <td>0.96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.97</th>\n",
       "      <td>460.0</td>\n",
       "      <td>149.0</td>\n",
       "      <td>1187.88</td>\n",
       "      <td>14975.00</td>\n",
       "      <td>5463.31</td>\n",
       "      <td>13438.28</td>\n",
       "      <td>26125.08</td>\n",
       "      <td>222.62</td>\n",
       "      <td>245.57</td>\n",
       "      <td>181.07</td>\n",
       "      <td>...</td>\n",
       "      <td>0.65</td>\n",
       "      <td>79.39</td>\n",
       "      <td>1485.0</td>\n",
       "      <td>88.84</td>\n",
       "      <td>98.62</td>\n",
       "      <td>122.75</td>\n",
       "      <td>0.26</td>\n",
       "      <td>0.43</td>\n",
       "      <td>279.44</td>\n",
       "      <td>0.97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.98</th>\n",
       "      <td>462.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>1188.82</td>\n",
       "      <td>14996.06</td>\n",
       "      <td>5473.80</td>\n",
       "      <td>13459.68</td>\n",
       "      <td>26412.78</td>\n",
       "      <td>225.34</td>\n",
       "      <td>245.68</td>\n",
       "      <td>181.72</td>\n",
       "      <td>...</td>\n",
       "      <td>0.65</td>\n",
       "      <td>79.59</td>\n",
       "      <td>1487.0</td>\n",
       "      <td>90.48</td>\n",
       "      <td>99.12</td>\n",
       "      <td>123.41</td>\n",
       "      <td>0.26</td>\n",
       "      <td>0.45</td>\n",
       "      <td>279.51</td>\n",
       "      <td>0.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0.99</th>\n",
       "      <td>470.0</td>\n",
       "      <td>150.0</td>\n",
       "      <td>1189.37</td>\n",
       "      <td>15013.35</td>\n",
       "      <td>5485.81</td>\n",
       "      <td>13479.14</td>\n",
       "      <td>26741.58</td>\n",
       "      <td>227.17</td>\n",
       "      <td>245.89</td>\n",
       "      <td>182.79</td>\n",
       "      <td>...</td>\n",
       "      <td>0.65</td>\n",
       "      <td>79.82</td>\n",
       "      <td>1488.0</td>\n",
       "      <td>92.71</td>\n",
       "      <td>99.53</td>\n",
       "      <td>124.09</td>\n",
       "      <td>0.26</td>\n",
       "      <td>0.48</td>\n",
       "      <td>279.84</td>\n",
       "      <td>0.99</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>99 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      CG_LT_GL_GL04_FCokeRate  CG_LT_GL_GL04_FCoalRate  CG_LT_GL_GL04_RFWD  \\\n",
       "0.01                    350.0                    120.0             1160.40   \n",
       "0.02                    351.0                    121.0             1161.57   \n",
       "0.03                    351.0                    121.0             1162.93   \n",
       "0.04                    351.0                    122.0             1163.91   \n",
       "0.05                    352.0                    123.0             1164.42   \n",
       "...                       ...                      ...                 ...   \n",
       "0.95                    452.0                    149.0             1184.75   \n",
       "0.96                    460.0                    149.0             1185.33   \n",
       "0.97                    460.0                    149.0             1187.88   \n",
       "0.98                    462.0                    150.0             1188.82   \n",
       "0.99                    470.0                    150.0             1189.37   \n",
       "\n",
       "      CG_LT_GL_GL04_FYLL  CG_LT_GL_GL04_LFLL  CG_LT_GL_GL04_GFDNKG  \\\n",
       "0.01            10003.17             4818.69              10127.17   \n",
       "0.02            10006.45             4834.09              10265.96   \n",
       "0.03            10012.12             4851.97              10337.50   \n",
       "0.04            10059.05             4867.69              10430.54   \n",
       "0.05            10189.04             4884.61              10493.61   \n",
       "...                  ...                 ...                   ...   \n",
       "0.95            14488.90             5444.65              13404.73   \n",
       "0.96            14765.18             5454.04              13421.27   \n",
       "0.97            14975.00             5463.31              13438.28   \n",
       "0.98            14996.06             5473.80              13459.68   \n",
       "0.99            15013.35             5485.81              13479.14   \n",
       "\n",
       "      CG_LT_GL_GL04_RFH  CG_LT_GL_GL04_DW  CG_LT_GL_GL04_LDYL  \\\n",
       "0.01           11240.44            140.58              225.30   \n",
       "0.02           11930.40            141.13              227.59   \n",
       "0.03           12345.03            141.74              228.83   \n",
       "0.04           12581.28            142.32              229.74   \n",
       "0.05           12864.26            142.83              230.33   \n",
       "...                 ...               ...                 ...   \n",
       "0.95           25940.98            218.84              245.41   \n",
       "0.96           25960.04            220.90              245.48   \n",
       "0.97           26125.08            222.62              245.57   \n",
       "0.98           26412.78            225.34              245.68   \n",
       "0.99           26741.58            227.17              245.89   \n",
       "\n",
       "      CG_LT_GL_GL04_YC  ...  CG_LT_GL_GL04_ZXQL  CG_LT_GL_GL04_XBYCZB  \\\n",
       "0.01            160.43  ...                0.46                 65.45   \n",
       "0.02            160.77  ...                0.47                 65.82   \n",
       "0.03            161.15  ...                0.47                 66.25   \n",
       "0.04            161.53  ...                0.47                 66.59   \n",
       "0.05            161.91  ...                0.48                 66.90   \n",
       "...                ...  ...                 ...                   ...   \n",
       "0.95            180.39  ...                0.64                 79.04   \n",
       "0.96            180.73  ...                0.64                 79.23   \n",
       "0.97            181.07  ...                0.65                 79.39   \n",
       "0.98            181.72  ...                0.65                 79.59   \n",
       "0.99            182.79  ...                0.65                 79.82   \n",
       "\n",
       "      CG_LT_GL_GL04_Ftswd  CG_LT_GL_GL04_19507WDPJ  CG_LT_GL_GL04_26275WDPJ  \\\n",
       "0.01               1450.0                    56.01                    71.30   \n",
       "0.02               1450.0                    56.76                    72.70   \n",
       "0.03               1450.0                    57.34                    74.21   \n",
       "0.04               1450.0                    57.71                    74.99   \n",
       "0.05               1450.0                    58.03                    75.99   \n",
       "...                   ...                      ...                      ...   \n",
       "0.95               1485.0                    86.36                    97.84   \n",
       "0.96               1485.0                    87.64                    98.19   \n",
       "0.97               1485.0                    88.84                    98.62   \n",
       "0.98               1487.0                    90.48                    99.12   \n",
       "0.99               1488.0                    92.71                    99.53   \n",
       "\n",
       "      CG_LT_GL_GL04_34800WDPJ  CG_LT_GL_GL04_V  CG_LT_GL_GL04_Si_Ti  \\\n",
       "0.01                    85.52             0.17                 0.16   \n",
       "0.02                    85.93             0.18                 0.16   \n",
       "0.03                    86.29             0.18                 0.17   \n",
       "0.04                    86.87             0.19                 0.18   \n",
       "0.05                    87.31             0.19                 0.18   \n",
       "...                       ...              ...                  ...   \n",
       "0.95                   121.10             0.26                 0.40   \n",
       "0.96                   121.78             0.26                 0.41   \n",
       "0.97                   122.75             0.26                 0.43   \n",
       "0.98                   123.41             0.26                 0.45   \n",
       "0.99                   124.09             0.26                 0.48   \n",
       "\n",
       "      CG_LT_GL_GL04_Fliluntie  perc  \n",
       "0.01                   240.42  0.01  \n",
       "0.02                   240.66  0.02  \n",
       "0.03                   241.02  0.03  \n",
       "0.04                   241.08  0.04  \n",
       "0.05                   241.14  0.05  \n",
       "...                       ...   ...  \n",
       "0.95                   278.88  0.95  \n",
       "0.96                   279.24  0.96  \n",
       "0.97                   279.44  0.97  \n",
       "0.98                   279.51  0.98  \n",
       "0.99                   279.84  0.99  \n",
       "\n",
       "[99 rows x 22 columns]"
      ]
     },
     "execution_count": 153,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#生成有效数据集 edf\n",
    "edf = pd.DataFrame()\n",
    "for param in key_params:\n",
    "    tdf = df[[param]]\n",
    "    #按上下边界卡值\n",
    "    ret_df = tdf[(tdf[param] >= final_map[param]['lower_bound']) & \\\n",
    "                 (tdf[param] <= final_map[param]['upper_bound'])]\n",
    "    #计算分位数\n",
    "    qdf = calculate_quantile(ret_df)\n",
    "    edf = pd.concat([edf,qdf], axis=1)\n",
    "\n",
    "#添加分位数字段\n",
    "edf['perc'] = edf.index\n",
    "\n",
    "#全部取2位小数，会造成精度丢失，产生很多重复值\n",
    "#假设参数可以忽略2位小数以后的精度，减少分段\n",
    "edf = edf.round(2)\n",
    "\n",
    "#分位数计算结果\n",
    "edf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {},
   "outputs": [],
   "source": [
    "#添加权重，分数和上下限 函数\n",
    "def get_weight_score(edf, name, type):\n",
    "    \n",
    "    #合并同值分段\n",
    "    grp = edf.groupby(name)\n",
    "    #同值分段所占的百分位\n",
    "    max = grp['perc'].max().rename(\"max_perc\")\n",
    "    min = grp['perc'].min().rename(\"min_perc\")\n",
    "\n",
    "    final_df = pd.DataFrame()\n",
    "\n",
    "    final_df = pd.concat([final_df, min, max], axis=1)\n",
    "    final_df[name] = final_df.index\n",
    "\n",
    "    # 权重设定的基数，依据参数值对应的百分位数来设定，\n",
    "    # 参数值可能对应一个范围的百分位值，为防止偏移，取所占百分位段的平均值\n",
    "    # 权重设定的规则：\n",
    "    # 递减指标（RLB、Ftswd、Si_Ti）：1- (所占最小百分位+所占最大百分位)/2\n",
    "    # 递增指标（Fliluntie、V）：(所占最小百分位+所占最大百分位)/2\n",
    "    final_df['last_min_perc'] = final_df['min_perc'].shift(+1)\n",
    " \n",
    "    final_df['last_max_perc'] = final_df['max_perc'].shift(+1)\n",
    "   \n",
    "    final_df['last_min_perc']=final_df['last_min_perc'].fillna(0)\n",
    "    final_df['last_max_perc']=final_df['last_max_perc'].fillna(0) \n",
    "    \n",
    "    if type == 'Asc':\n",
    "        #final_df['sub_weight'] = (final_df['min_perc']+final_df['max_perc'])/2\n",
    "        final_df['sub_weight'] = (final_df['last_min_perc']+final_df['last_min_perc'])/2\n",
    "        \n",
    "    else:\n",
    "        final_df['sub_weight'] = 1-(final_df['last_min_perc']+final_df['last_min_perc'])/2\n",
    "        \n",
    "    #final_df['last_min_perc'].fillna(0)\n",
    "    #final_df['last_max_perc'].fillna(0)  \n",
    " \n",
    "    final_df['score'] = 65 + 35*final_df['sub_weight']\n",
    "    \n",
    "\n",
    "    #寻找取值区间, 因为lower_bound 是所在区间的值，即基准值，upper_bound 是下一个区间的值\n",
    "    #所以使用的时候，一律采用左闭右开 [lower_bound, upper_bound)\n",
    "\n",
    "    final_df['lower_bound'] = final_df[name]\n",
    "    final_df['upper_bound'] = final_df[name].shift(-1)\n",
    "\n",
    "\n",
    "    #最低下限和最高上线替换位final_map中的上下限, 不能依据现有数据集合范围\n",
    "    # 此区间还在合理范围，不能丢掉\n",
    "    final_df['lower_bound'][0] = final_map[name]['lower_bound']\n",
    "    final_df['upper_bound'][len(final_df)-1] = final_map[name]['upper_bound']\n",
    "   \n",
    "    col_order = ['min_perc', 'max_perc','last_min_perc', 'last_max_perc','lower_bound', 'upper_bound', 'sub_weight', 'score', name]\n",
    "    final_df = final_df[col_order]\n",
    "    return final_df\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\sijin\\AppData\\Local\\Temp/ipykernel_19536/1710882415.py:49: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  final_df['lower_bound'][0] = final_map[name]['lower_bound']\n",
      "C:\\Users\\sijin\\AppData\\Local\\Temp/ipykernel_19536/1710882415.py:50: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  final_df['upper_bound'][len(final_df)-1] = final_map[name]['upper_bound']\n"
     ]
    }
   ],
   "source": [
    "final_result = {}\n",
    "\n",
    "for p in key_params:\n",
    "    final_result[p] = get_weight_score(edf, p, key_dict[p])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>min_perc</th>\n",
       "      <th>max_perc</th>\n",
       "      <th>last_min_perc</th>\n",
       "      <th>last_max_perc</th>\n",
       "      <th>lower_bound</th>\n",
       "      <th>upper_bound</th>\n",
       "      <th>sub_weight</th>\n",
       "      <th>score</th>\n",
       "      <th>CG_LT_GL_GL04_Fliluntie</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>240.42</th>\n",
       "      <td>0.01</td>\n",
       "      <td>0.01</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>240</td>\n",
       "      <td>240.66</td>\n",
       "      <td>0.00</td>\n",
       "      <td>65.00</td>\n",
       "      <td>240.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>240.66</th>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.01</td>\n",
       "      <td>0.01</td>\n",
       "      <td>240.66</td>\n",
       "      <td>241.02</td>\n",
       "      <td>0.01</td>\n",
       "      <td>65.35</td>\n",
       "      <td>240.66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241.02</th>\n",
       "      <td>0.03</td>\n",
       "      <td>0.03</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>241.02</td>\n",
       "      <td>241.08</td>\n",
       "      <td>0.02</td>\n",
       "      <td>65.70</td>\n",
       "      <td>241.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241.08</th>\n",
       "      <td>0.04</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.03</td>\n",
       "      <td>0.03</td>\n",
       "      <td>241.08</td>\n",
       "      <td>241.14</td>\n",
       "      <td>0.03</td>\n",
       "      <td>66.05</td>\n",
       "      <td>241.08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241.14</th>\n",
       "      <td>0.05</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.04</td>\n",
       "      <td>241.14</td>\n",
       "      <td>241.44</td>\n",
       "      <td>0.04</td>\n",
       "      <td>66.40</td>\n",
       "      <td>241.14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>278.88</th>\n",
       "      <td>0.95</td>\n",
       "      <td>0.95</td>\n",
       "      <td>0.94</td>\n",
       "      <td>0.94</td>\n",
       "      <td>278.88</td>\n",
       "      <td>279.24</td>\n",
       "      <td>0.94</td>\n",
       "      <td>97.90</td>\n",
       "      <td>278.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>279.24</th>\n",
       "      <td>0.96</td>\n",
       "      <td>0.96</td>\n",
       "      <td>0.95</td>\n",
       "      <td>0.95</td>\n",
       "      <td>279.24</td>\n",
       "      <td>279.44</td>\n",
       "      <td>0.95</td>\n",
       "      <td>98.25</td>\n",
       "      <td>279.24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>279.44</th>\n",
       "      <td>0.97</td>\n",
       "      <td>0.97</td>\n",
       "      <td>0.96</td>\n",
       "      <td>0.96</td>\n",
       "      <td>279.44</td>\n",
       "      <td>279.51</td>\n",
       "      <td>0.96</td>\n",
       "      <td>98.60</td>\n",
       "      <td>279.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>279.51</th>\n",
       "      <td>0.98</td>\n",
       "      <td>0.98</td>\n",
       "      <td>0.97</td>\n",
       "      <td>0.97</td>\n",
       "      <td>279.51</td>\n",
       "      <td>279.84</td>\n",
       "      <td>0.97</td>\n",
       "      <td>98.95</td>\n",
       "      <td>279.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>279.84</th>\n",
       "      <td>0.99</td>\n",
       "      <td>0.99</td>\n",
       "      <td>0.98</td>\n",
       "      <td>0.98</td>\n",
       "      <td>279.84</td>\n",
       "      <td>280</td>\n",
       "      <td>0.98</td>\n",
       "      <td>99.30</td>\n",
       "      <td>279.84</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>98 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        min_perc  max_perc  last_min_perc  last_max_perc lower_bound  \\\n",
       "240.42      0.01      0.01           0.00           0.00         240   \n",
       "240.66      0.02      0.02           0.01           0.01      240.66   \n",
       "241.02      0.03      0.03           0.02           0.02      241.02   \n",
       "241.08      0.04      0.04           0.03           0.03      241.08   \n",
       "241.14      0.05      0.05           0.04           0.04      241.14   \n",
       "...          ...       ...            ...            ...         ...   \n",
       "278.88      0.95      0.95           0.94           0.94      278.88   \n",
       "279.24      0.96      0.96           0.95           0.95      279.24   \n",
       "279.44      0.97      0.97           0.96           0.96      279.44   \n",
       "279.51      0.98      0.98           0.97           0.97      279.51   \n",
       "279.84      0.99      0.99           0.98           0.98      279.84   \n",
       "\n",
       "       upper_bound  sub_weight  score CG_LT_GL_GL04_Fliluntie  \n",
       "240.42      240.66        0.00  65.00                  240.42  \n",
       "240.66      241.02        0.01  65.35                  240.66  \n",
       "241.02      241.08        0.02  65.70                  241.02  \n",
       "241.08      241.14        0.03  66.05                  241.08  \n",
       "241.14      241.44        0.04  66.40                  241.14  \n",
       "...            ...         ...    ...                     ...  \n",
       "278.88      279.24        0.94  97.90                  278.88  \n",
       "279.24      279.44        0.95  98.25                  279.24  \n",
       "279.44      279.51        0.96  98.60                  279.44  \n",
       "279.51      279.84        0.97  98.95                  279.51  \n",
       "279.84         280        0.98  99.30                  279.84  \n",
       "\n",
       "[98 rows x 9 columns]"
      ]
     },
     "execution_count": 156,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "####操作参数\n",
    "final_result['CG_LT_GL_GL04_FCokeRate']\n",
    "final_result['CG_LT_GL_GL04_FCoalRate']\n",
    "final_result['CG_LT_GL_GL04_RFWD']\n",
    "final_result['CG_LT_GL_GL04_GFDNKG']\n",
    "final_result['CG_LT_GL_GL04_FYLL']\n",
    "final_result['CG_LT_GL_GL04_RFH']\n",
    "###状态参数\n",
    "final_result['CG_LT_GL_GL04_DW']\n",
    "final_result['CG_LT_GL_GL04_LDYL']\n",
    "final_result['CG_LT_GL_GL04_YC']\n",
    "final_result['CG_LT_GL_GL04_TQXZS']\n",
    "final_result['CG_LT_GL_GL04_MQLYL']\n",
    "final_result['CG_LT_GL_GL04_ZXQL']\n",
    "final_result['CG_LT_GL_GL04_XBYCZB']\n",
    "final_result['CG_LT_GL_GL04_Ftswd']\n",
    "final_result['CG_LT_GL_GL04_19507WDPJ']\n",
    "final_result['CG_LT_GL_GL04_26275WDPJ']\n",
    "final_result['CG_LT_GL_GL04_34800WDPJ']\n",
    "###经济指标\n",
    "final_result['CG_LT_GL_GL04_V']\n",
    "final_result['CG_LT_GL_GL04_Si_Ti']\n",
    "final_result['CG_LT_GL_GL04_FCoalRate']\n",
    "final_result['CG_LT_GL_GL04_FCokeRate']\n",
    "final_result['CG_LT_GL_GL04_Fliluntie']\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 157,
   "metadata": {},
   "outputs": [],
   "source": [
    "from interval import Interval\n",
    "\n",
    "#生成评分可用的评分字典\n",
    "score_dict = {}\n",
    "\n",
    "for param in key_params:\n",
    "    idict = {}\n",
    "    score_dict[param] = idict\n",
    "    tdf = final_result[param]\n",
    "    for index, row in tdf.iterrows():\n",
    "        i = Interval(row['lower_bound'], row['upper_bound'],lower_closed=True, upper_closed=False)\n",
    "        idict[i] = row['score'] \n",
    "       \n",
    "              "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{Interval(240, 240.66, lower_closed=True, upper_closed=False): 65.0,\n",
       " Interval(240.66, 241.02, lower_closed=True, upper_closed=False): 65.35,\n",
       " Interval(241.02, 241.08, lower_closed=True, upper_closed=False): 65.7,\n",
       " Interval(241.08, 241.14, lower_closed=True, upper_closed=False): 66.05,\n",
       " Interval(241.14, 241.44, lower_closed=True, upper_closed=False): 66.4,\n",
       " Interval(241.44, 241.62, lower_closed=True, upper_closed=False): 66.75,\n",
       " Interval(241.62, 241.86, lower_closed=True, upper_closed=False): 67.1,\n",
       " Interval(241.86, 242.04, lower_closed=True, upper_closed=False): 67.45,\n",
       " Interval(242.04, 242.16, lower_closed=True, upper_closed=False): 67.8,\n",
       " Interval(242.16, 242.28, lower_closed=True, upper_closed=False): 68.15,\n",
       " Interval(242.28, 242.46, lower_closed=True, upper_closed=False): 68.5,\n",
       " Interval(242.46, 242.76, lower_closed=True, upper_closed=False): 68.85,\n",
       " Interval(242.76, 242.88, lower_closed=True, upper_closed=False): 69.2,\n",
       " Interval(242.88, 243.36, lower_closed=True, upper_closed=False): 69.55,\n",
       " Interval(243.36, 243.84, lower_closed=True, upper_closed=False): 69.9,\n",
       " Interval(243.84, 244.02, lower_closed=True, upper_closed=False): 70.25,\n",
       " Interval(244.02, 244.26, lower_closed=True, upper_closed=False): 70.6,\n",
       " Interval(244.26, 244.98, lower_closed=True, upper_closed=False): 70.95,\n",
       " Interval(244.98, 245.53, lower_closed=True, upper_closed=False): 71.3,\n",
       " Interval(245.53, 246.24, lower_closed=True, upper_closed=False): 71.65,\n",
       " Interval(246.24, 247.02, lower_closed=True, upper_closed=False): 72.0,\n",
       " Interval(247.02, 248.88, lower_closed=True, upper_closed=False): 72.35,\n",
       " Interval(248.88, 249.88, lower_closed=True, upper_closed=False): 72.7,\n",
       " Interval(249.88, 250.56, lower_closed=True, upper_closed=False): 73.05,\n",
       " Interval(250.56, 251.04, lower_closed=True, upper_closed=False): 73.4,\n",
       " Interval(251.04, 252.46, lower_closed=True, upper_closed=False): 73.75,\n",
       " Interval(252.46, 253.61, lower_closed=True, upper_closed=False): 74.1,\n",
       " Interval(253.61, 254.67, lower_closed=True, upper_closed=False): 74.45,\n",
       " Interval(254.67, 255.72, lower_closed=True, upper_closed=False): 74.8,\n",
       " Interval(255.72, 256.2, lower_closed=True, upper_closed=False): 75.15,\n",
       " Interval(256.2, 256.68, lower_closed=True, upper_closed=False): 75.5,\n",
       " Interval(256.68, 256.92, lower_closed=True, upper_closed=False): 75.85,\n",
       " Interval(256.92, 257.2, lower_closed=True, upper_closed=False): 76.2,\n",
       " Interval(257.2, 257.34, lower_closed=True, upper_closed=False): 76.55,\n",
       " Interval(257.34, 257.46, lower_closed=True, upper_closed=False): 76.9,\n",
       " Interval(257.46, 257.58, lower_closed=True, upper_closed=False): 77.25,\n",
       " Interval(257.58, 257.64, lower_closed=True, upper_closed=False): 77.6,\n",
       " Interval(257.64, 257.82, lower_closed=True, upper_closed=False): 77.95,\n",
       " Interval(257.82, 257.94, lower_closed=True, upper_closed=False): 78.3,\n",
       " Interval(257.94, 258.18, lower_closed=True, upper_closed=False): 78.65,\n",
       " Interval(258.18, 258.42, lower_closed=True, upper_closed=False): 79.0,\n",
       " Interval(258.42, 258.93, lower_closed=True, upper_closed=False): 79.35,\n",
       " Interval(258.93, 259.32, lower_closed=True, upper_closed=False): 79.7,\n",
       " Interval(259.32, 259.62, lower_closed=True, upper_closed=False): 80.05,\n",
       " Interval(259.62, 259.74, lower_closed=True, upper_closed=False): 80.4,\n",
       " Interval(259.74, 259.92, lower_closed=True, upper_closed=False): 80.75,\n",
       " Interval(259.92, 260.1, lower_closed=True, upper_closed=False): 81.1,\n",
       " Interval(260.1, 260.4, lower_closed=True, upper_closed=False): 81.45,\n",
       " Interval(260.4, 260.76, lower_closed=True, upper_closed=False): 82.15,\n",
       " Interval(260.76, 261.18, lower_closed=True, upper_closed=False): 82.5,\n",
       " Interval(261.18, 261.42, lower_closed=True, upper_closed=False): 82.85,\n",
       " Interval(261.42, 261.59, lower_closed=True, upper_closed=False): 83.2,\n",
       " Interval(261.59, 261.72, lower_closed=True, upper_closed=False): 83.55,\n",
       " Interval(261.72, 261.78, lower_closed=True, upper_closed=False): 83.9,\n",
       " Interval(261.78, 262.02, lower_closed=True, upper_closed=False): 84.25,\n",
       " Interval(262.02, 262.2, lower_closed=True, upper_closed=False): 84.6,\n",
       " Interval(262.2, 262.92, lower_closed=True, upper_closed=False): 84.95,\n",
       " Interval(262.92, 263.38, lower_closed=True, upper_closed=False): 85.3,\n",
       " Interval(263.38, 264.11, lower_closed=True, upper_closed=False): 85.65,\n",
       " Interval(264.11, 264.42, lower_closed=True, upper_closed=False): 86.0,\n",
       " Interval(264.42, 264.79, lower_closed=True, upper_closed=False): 86.35,\n",
       " Interval(264.79, 265.3, lower_closed=True, upper_closed=False): 86.7,\n",
       " Interval(265.3, 265.56, lower_closed=True, upper_closed=False): 87.05,\n",
       " Interval(265.56, 265.62, lower_closed=True, upper_closed=False): 87.4,\n",
       " Interval(265.62, 265.74, lower_closed=True, upper_closed=False): 87.75,\n",
       " Interval(265.74, 266.04, lower_closed=True, upper_closed=False): 88.1,\n",
       " Interval(266.04, 266.76, lower_closed=True, upper_closed=False): 88.45,\n",
       " Interval(266.76, 267.22, lower_closed=True, upper_closed=False): 88.8,\n",
       " Interval(267.22, 268.98, lower_closed=True, upper_closed=False): 89.15,\n",
       " Interval(268.98, 271.02, lower_closed=True, upper_closed=False): 89.5,\n",
       " Interval(271.02, 271.32, lower_closed=True, upper_closed=False): 89.85,\n",
       " Interval(271.32, 271.62, lower_closed=True, upper_closed=False): 90.2,\n",
       " Interval(271.62, 272.34, lower_closed=True, upper_closed=False): 90.55,\n",
       " Interval(272.34, 273.4, lower_closed=True, upper_closed=False): 90.9,\n",
       " Interval(273.4, 273.91, lower_closed=True, upper_closed=False): 91.25,\n",
       " Interval(273.91, 274.2, lower_closed=True, upper_closed=False): 91.6,\n",
       " Interval(274.2, 274.5, lower_closed=True, upper_closed=False): 91.95,\n",
       " Interval(274.5, 274.62, lower_closed=True, upper_closed=False): 92.3,\n",
       " Interval(274.62, 274.89, lower_closed=True, upper_closed=False): 92.65,\n",
       " Interval(274.89, 275.1, lower_closed=True, upper_closed=False): 93.0,\n",
       " Interval(275.1, 275.5, lower_closed=True, upper_closed=False): 93.35,\n",
       " Interval(275.5, 275.87, lower_closed=True, upper_closed=False): 93.7,\n",
       " Interval(275.87, 276.43, lower_closed=True, upper_closed=False): 94.05,\n",
       " Interval(276.43, 276.84, lower_closed=True, upper_closed=False): 94.4,\n",
       " Interval(276.84, 276.87, lower_closed=True, upper_closed=False): 94.75,\n",
       " Interval(276.87, 277.13, lower_closed=True, upper_closed=False): 95.1,\n",
       " Interval(277.13, 277.38, lower_closed=True, upper_closed=False): 95.45,\n",
       " Interval(277.38, 277.7, lower_closed=True, upper_closed=False): 95.8,\n",
       " Interval(277.7, 278.1, lower_closed=True, upper_closed=False): 96.15,\n",
       " Interval(278.1, 278.22, lower_closed=True, upper_closed=False): 96.5,\n",
       " Interval(278.22, 278.39, lower_closed=True, upper_closed=False): 96.85,\n",
       " Interval(278.39, 278.68, lower_closed=True, upper_closed=False): 97.2,\n",
       " Interval(278.68, 278.88, lower_closed=True, upper_closed=False): 97.55000000000001,\n",
       " Interval(278.88, 279.24, lower_closed=True, upper_closed=False): 97.9,\n",
       " Interval(279.24, 279.44, lower_closed=True, upper_closed=False): 98.25,\n",
       " Interval(279.44, 279.51, lower_closed=True, upper_closed=False): 98.6,\n",
       " Interval(279.51, 279.84, lower_closed=True, upper_closed=False): 98.94999999999999,\n",
       " Interval(279.84, 280, lower_closed=True, upper_closed=False): 99.3}"
      ]
     },
     "execution_count": 158,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "####操作参数\n",
    "score_dict['CG_LT_GL_GL04_FCokeRate']\n",
    "score_dict['CG_LT_GL_GL04_FCoalRate']\n",
    "score_dict['CG_LT_GL_GL04_RFWD']\n",
    "score_dict['CG_LT_GL_GL04_GFDNKG']\n",
    "score_dict['CG_LT_GL_GL04_LFLL']\n",
    "score_dict['CG_LT_GL_GL04_FYLL']\n",
    "score_dict['CG_LT_GL_GL04_RFH']\n",
    "###状态参数\n",
    "score_dict['CG_LT_GL_GL04_DW']\n",
    "score_dict['CG_LT_GL_GL04_LDYL']\n",
    "score_dict['CG_LT_GL_GL04_YC']\n",
    "score_dict['CG_LT_GL_GL04_TQXZS']\n",
    "score_dict['CG_LT_GL_GL04_MQLYL']\n",
    "score_dict['CG_LT_GL_GL04_ZXQL']\n",
    "score_dict['CG_LT_GL_GL04_XBYCZB']\n",
    "score_dict['CG_LT_GL_GL04_Ftswd']\n",
    "score_dict['CG_LT_GL_GL04_19507WDPJ']\n",
    "score_dict['CG_LT_GL_GL04_26275WDPJ']\n",
    "score_dict['CG_LT_GL_GL04_34800WDPJ']\n",
    "\n",
    "###经济指标\n",
    "score_dict['CG_LT_GL_GL04_V']\n",
    "score_dict['CG_LT_GL_GL04_Si_Ti']\n",
    "score_dict['CG_LT_GL_GL04_FCoalRate']\n",
    "score_dict['CG_LT_GL_GL04_FCokeRate']\n",
    "score_dict['CG_LT_GL_GL04_Fliluntie']\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 159,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DateTime</th>\n",
       "      <th>FDate</th>\n",
       "      <th>FHour</th>\n",
       "      <th>CG_LT_GL_GL04_Ftswd</th>\n",
       "      <th>CG_LT_GL_GL04_V</th>\n",
       "      <th>CG_LT_GL_GL04_Si_Ti</th>\n",
       "      <th>CG_LT_GL_GL04_Fliluntie</th>\n",
       "      <th>CG_LT_GL_GL04_CWPRE</th>\n",
       "      <th>CG_LT_GL_GL04_LFLL</th>\n",
       "      <th>CG_LT_GL_GL04_RFYL02</th>\n",
       "      <th>...</th>\n",
       "      <th>CG_TQ_GL_GL04_TLZB</th>\n",
       "      <th>CG_TQ_GL_GL04_DTHY</th>\n",
       "      <th>CG_LT_GL_GL04_ZBYCPJ</th>\n",
       "      <th>CG_LT_GL_GL04_19507WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_26275WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_34800WDPJ</th>\n",
       "      <th>gaolu_score1</th>\n",
       "      <th>gaolu_score2</th>\n",
       "      <th>gaolu_score3</th>\n",
       "      <th>gaolu_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>8</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>260.52</td>\n",
       "      <td>408.577829</td>\n",
       "      <td>5052.245402</td>\n",
       "      <td>400.454975</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>20.200611</td>\n",
       "      <td>70.602716</td>\n",
       "      <td>89.131791</td>\n",
       "      <td>105.706944</td>\n",
       "      <td>75.5175</td>\n",
       "      <td>80.7500</td>\n",
       "      <td>75.7275</td>\n",
       "      <td>82.684651</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>9</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>257.76</td>\n",
       "      <td>413.997722</td>\n",
       "      <td>5140.616348</td>\n",
       "      <td>404.381379</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>21.381455</td>\n",
       "      <td>67.929692</td>\n",
       "      <td>85.816328</td>\n",
       "      <td>108.583022</td>\n",
       "      <td>78.4225</td>\n",
       "      <td>81.7475</td>\n",
       "      <td>76.9875</td>\n",
       "      <td>82.923395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>10</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>257.76</td>\n",
       "      <td>416.416164</td>\n",
       "      <td>5153.132339</td>\n",
       "      <td>406.622834</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>21.149230</td>\n",
       "      <td>65.154321</td>\n",
       "      <td>88.940587</td>\n",
       "      <td>106.920036</td>\n",
       "      <td>79.8225</td>\n",
       "      <td>83.8650</td>\n",
       "      <td>78.8775</td>\n",
       "      <td>84.834281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>11</td>\n",
       "      <td>1468</td>\n",
       "      <td>0.2520</td>\n",
       "      <td>0.3567</td>\n",
       "      <td>300.72</td>\n",
       "      <td>413.238197</td>\n",
       "      <td>5040.816106</td>\n",
       "      <td>405.871499</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>19.825106</td>\n",
       "      <td>64.852533</td>\n",
       "      <td>88.592409</td>\n",
       "      <td>102.805276</td>\n",
       "      <td>75.0975</td>\n",
       "      <td>83.9700</td>\n",
       "      <td>71.3525</td>\n",
       "      <td>81.423522</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>12</td>\n",
       "      <td>1468</td>\n",
       "      <td>0.2520</td>\n",
       "      <td>0.3567</td>\n",
       "      <td>257.76</td>\n",
       "      <td>414.913499</td>\n",
       "      <td>5036.044732</td>\n",
       "      <td>406.244274</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>19.766166</td>\n",
       "      <td>68.368734</td>\n",
       "      <td>90.733395</td>\n",
       "      <td>102.122676</td>\n",
       "      <td>76.2175</td>\n",
       "      <td>86.7700</td>\n",
       "      <td>79.7700</td>\n",
       "      <td>85.613241</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10451</th>\n",
       "      <td>2022/4/7 20:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>21</td>\n",
       "      <td>1462</td>\n",
       "      <td>0.1870</td>\n",
       "      <td>0.2015</td>\n",
       "      <td>284.20</td>\n",
       "      <td>421.215894</td>\n",
       "      <td>5455.090200</td>\n",
       "      <td>415.456502</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>23.866874</td>\n",
       "      <td>62.484755</td>\n",
       "      <td>57.702068</td>\n",
       "      <td>87.905487</td>\n",
       "      <td>78.5625</td>\n",
       "      <td>82.4650</td>\n",
       "      <td>73.5400</td>\n",
       "      <td>83.134051</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10452</th>\n",
       "      <td>2022/4/7 21:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>22</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.1898</td>\n",
       "      <td>0.2668</td>\n",
       "      <td>284.20</td>\n",
       "      <td>420.551847</td>\n",
       "      <td>5382.889380</td>\n",
       "      <td>415.444445</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.048841</td>\n",
       "      <td>63.383890</td>\n",
       "      <td>57.075895</td>\n",
       "      <td>87.070937</td>\n",
       "      <td>78.2125</td>\n",
       "      <td>83.3400</td>\n",
       "      <td>74.6075</td>\n",
       "      <td>83.501998</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10453</th>\n",
       "      <td>2022/4/7 22:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>23</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.2012</td>\n",
       "      <td>0.3207</td>\n",
       "      <td>324.80</td>\n",
       "      <td>421.545745</td>\n",
       "      <td>5351.422460</td>\n",
       "      <td>416.263289</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.160077</td>\n",
       "      <td>63.030310</td>\n",
       "      <td>56.857963</td>\n",
       "      <td>90.913126</td>\n",
       "      <td>76.4625</td>\n",
       "      <td>83.1825</td>\n",
       "      <td>72.4550</td>\n",
       "      <td>81.870114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10454</th>\n",
       "      <td>2022/4/7 23:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>24</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.2012</td>\n",
       "      <td>0.3207</td>\n",
       "      <td>284.20</td>\n",
       "      <td>419.824150</td>\n",
       "      <td>5367.476271</td>\n",
       "      <td>414.673827</td>\n",
       "      <td>...</td>\n",
       "      <td>50.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.588706</td>\n",
       "      <td>62.973828</td>\n",
       "      <td>56.737594</td>\n",
       "      <td>93.249515</td>\n",
       "      <td>78.2125</td>\n",
       "      <td>84.1800</td>\n",
       "      <td>74.8350</td>\n",
       "      <td>83.750104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10455</th>\n",
       "      <td>2022/4/8 0:00</td>\n",
       "      <td>2022/4/8</td>\n",
       "      <td>1</td>\n",
       "      <td>1465</td>\n",
       "      <td>0.2102</td>\n",
       "      <td>0.3177</td>\n",
       "      <td>283.71</td>\n",
       "      <td>421.984103</td>\n",
       "      <td>5422.489289</td>\n",
       "      <td>416.106559</td>\n",
       "      <td>...</td>\n",
       "      <td>50.0</td>\n",
       "      <td>261.0</td>\n",
       "      <td>25.645054</td>\n",
       "      <td>63.258180</td>\n",
       "      <td>57.772253</td>\n",
       "      <td>89.919792</td>\n",
       "      <td>78.4575</td>\n",
       "      <td>82.3075</td>\n",
       "      <td>73.5575</td>\n",
       "      <td>83.022638</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10456 rows × 59 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             DateTime      FDate  FHour  CG_LT_GL_GL04_Ftswd  CG_LT_GL_GL04_V  \\\n",
       "0             00:00.0  2020/8/21      8                 1473           0.2640   \n",
       "1             00:00.0  2020/8/21      9                 1473           0.2640   \n",
       "2             00:00.0  2020/8/21     10                 1473           0.2640   \n",
       "3             00:00.0  2020/8/21     11                 1468           0.2520   \n",
       "4             00:00.0  2020/8/21     12                 1468           0.2520   \n",
       "...               ...        ...    ...                  ...              ...   \n",
       "10451  2022/4/7 20:00   2022/4/7     21                 1462           0.1870   \n",
       "10452  2022/4/7 21:00   2022/4/7     22                 1450           0.1898   \n",
       "10453  2022/4/7 22:00   2022/4/7     23                 1450           0.2012   \n",
       "10454  2022/4/7 23:00   2022/4/7     24                 1450           0.2012   \n",
       "10455   2022/4/8 0:00   2022/4/8      1                 1465           0.2102   \n",
       "\n",
       "       CG_LT_GL_GL04_Si_Ti  CG_LT_GL_GL04_Fliluntie  CG_LT_GL_GL04_CWPRE  \\\n",
       "0                   0.2297                   260.52           408.577829   \n",
       "1                   0.2297                   257.76           413.997722   \n",
       "2                   0.2297                   257.76           416.416164   \n",
       "3                   0.3567                   300.72           413.238197   \n",
       "4                   0.3567                   257.76           414.913499   \n",
       "...                    ...                      ...                  ...   \n",
       "10451               0.2015                   284.20           421.215894   \n",
       "10452               0.2668                   284.20           420.551847   \n",
       "10453               0.3207                   324.80           421.545745   \n",
       "10454               0.3207                   284.20           419.824150   \n",
       "10455               0.3177                   283.71           421.984103   \n",
       "\n",
       "       CG_LT_GL_GL04_LFLL  CG_LT_GL_GL04_RFYL02  ...  CG_TQ_GL_GL04_TLZB  \\\n",
       "0             5052.245402            400.454975  ...                62.0   \n",
       "1             5140.616348            404.381379  ...                62.0   \n",
       "2             5153.132339            406.622834  ...                62.0   \n",
       "3             5040.816106            405.871499  ...                62.0   \n",
       "4             5036.044732            406.244274  ...                62.0   \n",
       "...                   ...                   ...  ...                 ...   \n",
       "10451         5455.090200            415.456502  ...                52.0   \n",
       "10452         5382.889380            415.444445  ...                52.0   \n",
       "10453         5351.422460            416.263289  ...                52.0   \n",
       "10454         5367.476271            414.673827  ...                50.0   \n",
       "10455         5422.489289            416.106559  ...                50.0   \n",
       "\n",
       "       CG_TQ_GL_GL04_DTHY  CG_LT_GL_GL04_ZBYCPJ  CG_LT_GL_GL04_19507WDPJ  \\\n",
       "0                   287.0             20.200611                70.602716   \n",
       "1                   287.0             21.381455                67.929692   \n",
       "2                   287.0             21.149230                65.154321   \n",
       "3                   287.0             19.825106                64.852533   \n",
       "4                   287.0             19.766166                68.368734   \n",
       "...                   ...                   ...                      ...   \n",
       "10451               271.0             23.866874                62.484755   \n",
       "10452               271.0             24.048841                63.383890   \n",
       "10453               271.0             24.160077                63.030310   \n",
       "10454               271.0             24.588706                62.973828   \n",
       "10455               261.0             25.645054                63.258180   \n",
       "\n",
       "       CG_LT_GL_GL04_26275WDPJ  CG_LT_GL_GL04_34800WDPJ  gaolu_score1  \\\n",
       "0                    89.131791               105.706944       75.5175   \n",
       "1                    85.816328               108.583022       78.4225   \n",
       "2                    88.940587               106.920036       79.8225   \n",
       "3                    88.592409               102.805276       75.0975   \n",
       "4                    90.733395               102.122676       76.2175   \n",
       "...                        ...                      ...           ...   \n",
       "10451                57.702068                87.905487       78.5625   \n",
       "10452                57.075895                87.070937       78.2125   \n",
       "10453                56.857963                90.913126       76.4625   \n",
       "10454                56.737594                93.249515       78.2125   \n",
       "10455                57.772253                89.919792       78.4575   \n",
       "\n",
       "       gaolu_score2  gaolu_score3  gaolu_score  \n",
       "0           80.7500       75.7275    82.684651  \n",
       "1           81.7475       76.9875    82.923395  \n",
       "2           83.8650       78.8775    84.834281  \n",
       "3           83.9700       71.3525    81.423522  \n",
       "4           86.7700       79.7700    85.613241  \n",
       "...             ...           ...          ...  \n",
       "10451       82.4650       73.5400    83.134051  \n",
       "10452       83.3400       74.6075    83.501998  \n",
       "10453       83.1825       72.4550    81.870114  \n",
       "10454       84.1800       74.8350    83.750104  \n",
       "10455       82.3075       73.5575    83.022638  \n",
       "\n",
       "[10456 rows x 59 columns]"
      ]
     },
     "execution_count": 159,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "####操作参数指标整体权重表\n",
    "key_param_weight = dict(CG_LT_GL_GL04_FCokeRate=0.17,\n",
    "               CG_LT_GL_GL04_FCoalRate=0.11, \n",
    "               CG_LT_GL_GL04_RFWD=0.06,\n",
    "               CG_LT_GL_GL04_FYLL=0.21,\n",
    "               CG_LT_GL_GL04_LFLL=0.32,\n",
    "               CG_LT_GL_GL04_GFDNKG=0.12,\n",
    "               CG_LT_GL_GL04_RFH=0.01)\n",
    "          \n",
    "\n",
    "# 获取子分数函数\n",
    "def get_sub_score(score_dict, param, value):\n",
    "    ld = score_dict[param]\n",
    "    for interval in ld.keys():\n",
    "        if value in interval:\n",
    "            return ld[interval]\n",
    "    return 65.0\n",
    "\n",
    "# 获取整体分数函数\n",
    "def get_score(score_dict, value_dict, param_weight):\n",
    "    score = 0\n",
    "    for k in value_dict.keys():\n",
    "        score += get_sub_score(score_dict, k, value_dict[k])*param_weight[k]\n",
    "    return score\n",
    "\n",
    "###操作参数分数生成\n",
    "df['gaolu_score1']= df.apply(lambda x: \\\n",
    "                      get_score(score_dict, \\\n",
    "                               dict(CG_LT_GL_GL04_FCokeRate=x['CG_LT_GL_GL04_FCokeRate'],\n",
    "                                    CG_LT_GL_GL04_FCoalRate=x['CG_LT_GL_GL04_FCoalRate'],\n",
    "                                    CG_LT_GL_GL04_RFWD=x['CG_LT_GL_GL04_RFWD'],\n",
    "                                    CG_LT_GL_GL04_FYLL=x['CG_LT_GL_GL04_FYLL'],\n",
    "                                    CG_LT_GL_GL04_LFLL=x['CG_LT_GL_GL04_LFLL'],\n",
    "                                    CG_LT_GL_GL04_GFDNKG=x['CG_LT_GL_GL04_GFDNKG'],\n",
    "                                    CG_LT_GL_GL04_RFH=x['CG_LT_GL_GL04_RFH']), \\\n",
    "                                key_param_weight), axis= 1)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 162,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DateTime</th>\n",
       "      <th>FDate</th>\n",
       "      <th>FHour</th>\n",
       "      <th>CG_LT_GL_GL04_Ftswd</th>\n",
       "      <th>CG_LT_GL_GL04_V</th>\n",
       "      <th>CG_LT_GL_GL04_Si_Ti</th>\n",
       "      <th>CG_LT_GL_GL04_Fliluntie</th>\n",
       "      <th>CG_LT_GL_GL04_CWPRE</th>\n",
       "      <th>CG_LT_GL_GL04_LFLL</th>\n",
       "      <th>CG_LT_GL_GL04_RFYL02</th>\n",
       "      <th>...</th>\n",
       "      <th>CG_TQ_GL_GL04_TLZB</th>\n",
       "      <th>CG_TQ_GL_GL04_DTHY</th>\n",
       "      <th>CG_LT_GL_GL04_ZBYCPJ</th>\n",
       "      <th>CG_LT_GL_GL04_19507WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_26275WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_34800WDPJ</th>\n",
       "      <th>gaolu_score1</th>\n",
       "      <th>gaolu_score2</th>\n",
       "      <th>gaolu_score3</th>\n",
       "      <th>gaolu_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>8</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>260.52</td>\n",
       "      <td>408.577829</td>\n",
       "      <td>5052.245402</td>\n",
       "      <td>400.454975</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>20.200611</td>\n",
       "      <td>70.602716</td>\n",
       "      <td>89.131791</td>\n",
       "      <td>105.706944</td>\n",
       "      <td>75.5175</td>\n",
       "      <td>83.2875</td>\n",
       "      <td>75.7275</td>\n",
       "      <td>82.684651</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>9</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>257.76</td>\n",
       "      <td>413.997722</td>\n",
       "      <td>5140.616348</td>\n",
       "      <td>404.381379</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>21.381455</td>\n",
       "      <td>67.929692</td>\n",
       "      <td>85.816328</td>\n",
       "      <td>108.583022</td>\n",
       "      <td>78.4225</td>\n",
       "      <td>82.4475</td>\n",
       "      <td>76.4975</td>\n",
       "      <td>82.923395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>10</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>257.76</td>\n",
       "      <td>416.416164</td>\n",
       "      <td>5153.132339</td>\n",
       "      <td>406.622834</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>21.149230</td>\n",
       "      <td>65.154321</td>\n",
       "      <td>88.940587</td>\n",
       "      <td>106.920036</td>\n",
       "      <td>79.8225</td>\n",
       "      <td>89.7625</td>\n",
       "      <td>78.6675</td>\n",
       "      <td>84.834281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>11</td>\n",
       "      <td>1468</td>\n",
       "      <td>0.2520</td>\n",
       "      <td>0.3567</td>\n",
       "      <td>300.72</td>\n",
       "      <td>413.238197</td>\n",
       "      <td>5040.816106</td>\n",
       "      <td>405.871499</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>19.825106</td>\n",
       "      <td>64.852533</td>\n",
       "      <td>88.592409</td>\n",
       "      <td>102.805276</td>\n",
       "      <td>75.0975</td>\n",
       "      <td>89.3075</td>\n",
       "      <td>70.8625</td>\n",
       "      <td>81.423522</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>12</td>\n",
       "      <td>1468</td>\n",
       "      <td>0.2520</td>\n",
       "      <td>0.3567</td>\n",
       "      <td>257.76</td>\n",
       "      <td>414.913499</td>\n",
       "      <td>5036.044732</td>\n",
       "      <td>406.244274</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>19.766166</td>\n",
       "      <td>68.368734</td>\n",
       "      <td>90.733395</td>\n",
       "      <td>102.122676</td>\n",
       "      <td>76.2175</td>\n",
       "      <td>88.3625</td>\n",
       "      <td>79.6300</td>\n",
       "      <td>85.613241</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10451</th>\n",
       "      <td>2022/4/7 20:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>21</td>\n",
       "      <td>1462</td>\n",
       "      <td>0.1870</td>\n",
       "      <td>0.2015</td>\n",
       "      <td>284.20</td>\n",
       "      <td>421.215894</td>\n",
       "      <td>5455.090200</td>\n",
       "      <td>415.456502</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>23.866874</td>\n",
       "      <td>62.484755</td>\n",
       "      <td>57.702068</td>\n",
       "      <td>87.905487</td>\n",
       "      <td>78.5625</td>\n",
       "      <td>85.5275</td>\n",
       "      <td>73.0500</td>\n",
       "      <td>83.134051</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10452</th>\n",
       "      <td>2022/4/7 21:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>22</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.1898</td>\n",
       "      <td>0.2668</td>\n",
       "      <td>284.20</td>\n",
       "      <td>420.551847</td>\n",
       "      <td>5382.889380</td>\n",
       "      <td>415.444445</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.048841</td>\n",
       "      <td>63.383890</td>\n",
       "      <td>57.075895</td>\n",
       "      <td>87.070937</td>\n",
       "      <td>78.2125</td>\n",
       "      <td>82.5875</td>\n",
       "      <td>74.3275</td>\n",
       "      <td>83.501998</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10453</th>\n",
       "      <td>2022/4/7 22:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>23</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.2012</td>\n",
       "      <td>0.3207</td>\n",
       "      <td>324.80</td>\n",
       "      <td>421.545745</td>\n",
       "      <td>5351.422460</td>\n",
       "      <td>416.263289</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.160077</td>\n",
       "      <td>63.030310</td>\n",
       "      <td>56.857963</td>\n",
       "      <td>90.913126</td>\n",
       "      <td>76.4625</td>\n",
       "      <td>85.0900</td>\n",
       "      <td>71.9650</td>\n",
       "      <td>81.870114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10454</th>\n",
       "      <td>2022/4/7 23:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>24</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.2012</td>\n",
       "      <td>0.3207</td>\n",
       "      <td>284.20</td>\n",
       "      <td>419.824150</td>\n",
       "      <td>5367.476271</td>\n",
       "      <td>414.673827</td>\n",
       "      <td>...</td>\n",
       "      <td>50.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.588706</td>\n",
       "      <td>62.973828</td>\n",
       "      <td>56.737594</td>\n",
       "      <td>93.249515</td>\n",
       "      <td>78.2125</td>\n",
       "      <td>86.7525</td>\n",
       "      <td>74.6250</td>\n",
       "      <td>83.750104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10455</th>\n",
       "      <td>2022/4/8 0:00</td>\n",
       "      <td>2022/4/8</td>\n",
       "      <td>1</td>\n",
       "      <td>1465</td>\n",
       "      <td>0.2102</td>\n",
       "      <td>0.3177</td>\n",
       "      <td>283.71</td>\n",
       "      <td>421.984103</td>\n",
       "      <td>5422.489289</td>\n",
       "      <td>416.106559</td>\n",
       "      <td>...</td>\n",
       "      <td>50.0</td>\n",
       "      <td>261.0</td>\n",
       "      <td>25.645054</td>\n",
       "      <td>63.258180</td>\n",
       "      <td>57.772253</td>\n",
       "      <td>89.919792</td>\n",
       "      <td>78.4575</td>\n",
       "      <td>81.0825</td>\n",
       "      <td>73.2075</td>\n",
       "      <td>83.022638</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10456 rows × 59 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             DateTime      FDate  FHour  CG_LT_GL_GL04_Ftswd  CG_LT_GL_GL04_V  \\\n",
       "0             00:00.0  2020/8/21      8                 1473           0.2640   \n",
       "1             00:00.0  2020/8/21      9                 1473           0.2640   \n",
       "2             00:00.0  2020/8/21     10                 1473           0.2640   \n",
       "3             00:00.0  2020/8/21     11                 1468           0.2520   \n",
       "4             00:00.0  2020/8/21     12                 1468           0.2520   \n",
       "...               ...        ...    ...                  ...              ...   \n",
       "10451  2022/4/7 20:00   2022/4/7     21                 1462           0.1870   \n",
       "10452  2022/4/7 21:00   2022/4/7     22                 1450           0.1898   \n",
       "10453  2022/4/7 22:00   2022/4/7     23                 1450           0.2012   \n",
       "10454  2022/4/7 23:00   2022/4/7     24                 1450           0.2012   \n",
       "10455   2022/4/8 0:00   2022/4/8      1                 1465           0.2102   \n",
       "\n",
       "       CG_LT_GL_GL04_Si_Ti  CG_LT_GL_GL04_Fliluntie  CG_LT_GL_GL04_CWPRE  \\\n",
       "0                   0.2297                   260.52           408.577829   \n",
       "1                   0.2297                   257.76           413.997722   \n",
       "2                   0.2297                   257.76           416.416164   \n",
       "3                   0.3567                   300.72           413.238197   \n",
       "4                   0.3567                   257.76           414.913499   \n",
       "...                    ...                      ...                  ...   \n",
       "10451               0.2015                   284.20           421.215894   \n",
       "10452               0.2668                   284.20           420.551847   \n",
       "10453               0.3207                   324.80           421.545745   \n",
       "10454               0.3207                   284.20           419.824150   \n",
       "10455               0.3177                   283.71           421.984103   \n",
       "\n",
       "       CG_LT_GL_GL04_LFLL  CG_LT_GL_GL04_RFYL02  ...  CG_TQ_GL_GL04_TLZB  \\\n",
       "0             5052.245402            400.454975  ...                62.0   \n",
       "1             5140.616348            404.381379  ...                62.0   \n",
       "2             5153.132339            406.622834  ...                62.0   \n",
       "3             5040.816106            405.871499  ...                62.0   \n",
       "4             5036.044732            406.244274  ...                62.0   \n",
       "...                   ...                   ...  ...                 ...   \n",
       "10451         5455.090200            415.456502  ...                52.0   \n",
       "10452         5382.889380            415.444445  ...                52.0   \n",
       "10453         5351.422460            416.263289  ...                52.0   \n",
       "10454         5367.476271            414.673827  ...                50.0   \n",
       "10455         5422.489289            416.106559  ...                50.0   \n",
       "\n",
       "       CG_TQ_GL_GL04_DTHY  CG_LT_GL_GL04_ZBYCPJ  CG_LT_GL_GL04_19507WDPJ  \\\n",
       "0                   287.0             20.200611                70.602716   \n",
       "1                   287.0             21.381455                67.929692   \n",
       "2                   287.0             21.149230                65.154321   \n",
       "3                   287.0             19.825106                64.852533   \n",
       "4                   287.0             19.766166                68.368734   \n",
       "...                   ...                   ...                      ...   \n",
       "10451               271.0             23.866874                62.484755   \n",
       "10452               271.0             24.048841                63.383890   \n",
       "10453               271.0             24.160077                63.030310   \n",
       "10454               271.0             24.588706                62.973828   \n",
       "10455               261.0             25.645054                63.258180   \n",
       "\n",
       "       CG_LT_GL_GL04_26275WDPJ  CG_LT_GL_GL04_34800WDPJ  gaolu_score1  \\\n",
       "0                    89.131791               105.706944       75.5175   \n",
       "1                    85.816328               108.583022       78.4225   \n",
       "2                    88.940587               106.920036       79.8225   \n",
       "3                    88.592409               102.805276       75.0975   \n",
       "4                    90.733395               102.122676       76.2175   \n",
       "...                        ...                      ...           ...   \n",
       "10451                57.702068                87.905487       78.5625   \n",
       "10452                57.075895                87.070937       78.2125   \n",
       "10453                56.857963                90.913126       76.4625   \n",
       "10454                56.737594                93.249515       78.2125   \n",
       "10455                57.772253                89.919792       78.4575   \n",
       "\n",
       "       gaolu_score2  gaolu_score3  gaolu_score  \n",
       "0           83.2875       75.7275    82.684651  \n",
       "1           82.4475       76.4975    82.923395  \n",
       "2           89.7625       78.6675    84.834281  \n",
       "3           89.3075       70.8625    81.423522  \n",
       "4           88.3625       79.6300    85.613241  \n",
       "...             ...           ...          ...  \n",
       "10451       85.5275       73.0500    83.134051  \n",
       "10452       82.5875       74.3275    83.501998  \n",
       "10453       85.0900       71.9650    81.870114  \n",
       "10454       86.7525       74.6250    83.750104  \n",
       "10455       81.0825       73.2075    83.022638  \n",
       "\n",
       "[10456 rows x 59 columns]"
      ]
     },
     "execution_count": 162,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "####状态参数指标整体权重表\n",
    "key_param_weight = dict(CG_LT_GL_GL04_DW=0.1,\n",
    "               CG_LT_GL_GL04_LDYL=0.05, \n",
    "               CG_LT_GL_GL04_YC=0.1,\n",
    "               CG_LT_GL_GL04_TQXZS=0.25,\n",
    "               CG_LT_GL_GL04_MQLYL=0.15,\n",
    "               CG_LT_GL_GL04_ZXQL=0.05,\n",
    "               CG_LT_GL_GL04_XBYCZB=0.05,\n",
    "               CG_LT_GL_GL04_Ftswd=0.1,         \n",
    "               CG_LT_GL_GL04_19507WDPJ=0.05,\n",
    "               CG_LT_GL_GL04_26275WDPJ=0.05,\n",
    "               CG_LT_GL_GL04_34800WDPJ=0.05)\n",
    "              \n",
    "\n",
    "# 获取子分数函数\n",
    "def get_sub_score(score_dict, param, value):\n",
    "    ld = score_dict[param]\n",
    "    for interval in ld.keys():\n",
    "        if value in interval:\n",
    "            return ld[interval]\n",
    "    return 65.0\n",
    "\n",
    "# 获取整体分数函数\n",
    "def get_score(score_dict, value_dict, param_weight):\n",
    "    score = 0\n",
    "    for k in value_dict.keys():\n",
    "        score += get_sub_score(score_dict, k, value_dict[k])*param_weight[k]\n",
    "    return score\n",
    "#整体分数生成\n",
    "df['gaolu_score2']= df.apply(lambda x: \\\n",
    "                      get_score(score_dict, \\\n",
    "                               dict(CG_LT_GL_GL04_DW=x['CG_LT_GL_GL04_DW'],\n",
    "                                    CG_LT_GL_GL04_LDYL=x['CG_LT_GL_GL04_LDYL'],\n",
    "                                    CG_LT_GL_GL04_YC=x['CG_LT_GL_GL04_YC'],\n",
    "                                    CG_LT_GL_GL04_TQXZS=x['CG_LT_GL_GL04_TQXZS'],\n",
    "                                    CG_LT_GL_GL04_MQLYL=x['CG_LT_GL_GL04_MQLYL'],\n",
    "                                    CG_LT_GL_GL04_ZXQL=x['CG_LT_GL_GL04_ZXQL'], \n",
    "                                    CG_LT_GL_GL04_XBYCZB=x['CG_LT_GL_GL04_XBYCZB'],\n",
    "                                    CG_LT_GL_GL04_Ftswd=x['CG_LT_GL_GL04_Ftswd'],\n",
    "                                    CG_LT_GL_GL04_19507WDPJ=x['CG_LT_GL_GL04_19507WDPJ'],\n",
    "                                    CG_LT_GL_GL04_26275WDPJ=x['CG_LT_GL_GL04_26275WDPJ'],\n",
    "                                    CG_LT_GL_GL04_34800WDPJ=x['CG_LT_GL_GL04_34800WDPJ']), \\\n",
    "                                key_param_weight), axis= 1)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 163,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DateTime</th>\n",
       "      <th>FDate</th>\n",
       "      <th>FHour</th>\n",
       "      <th>CG_LT_GL_GL04_Ftswd</th>\n",
       "      <th>CG_LT_GL_GL04_V</th>\n",
       "      <th>CG_LT_GL_GL04_Si_Ti</th>\n",
       "      <th>CG_LT_GL_GL04_Fliluntie</th>\n",
       "      <th>CG_LT_GL_GL04_CWPRE</th>\n",
       "      <th>CG_LT_GL_GL04_LFLL</th>\n",
       "      <th>CG_LT_GL_GL04_RFYL02</th>\n",
       "      <th>...</th>\n",
       "      <th>CG_TQ_GL_GL04_TLZB</th>\n",
       "      <th>CG_TQ_GL_GL04_DTHY</th>\n",
       "      <th>CG_LT_GL_GL04_ZBYCPJ</th>\n",
       "      <th>CG_LT_GL_GL04_19507WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_26275WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_34800WDPJ</th>\n",
       "      <th>gaolu_score1</th>\n",
       "      <th>gaolu_score2</th>\n",
       "      <th>gaolu_score3</th>\n",
       "      <th>gaolu_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>8</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>260.52</td>\n",
       "      <td>408.577829</td>\n",
       "      <td>5052.245402</td>\n",
       "      <td>400.454975</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>20.200611</td>\n",
       "      <td>70.602716</td>\n",
       "      <td>89.131791</td>\n",
       "      <td>105.706944</td>\n",
       "      <td>75.5175</td>\n",
       "      <td>83.2875</td>\n",
       "      <td>75.7275</td>\n",
       "      <td>82.684651</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>9</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>257.76</td>\n",
       "      <td>413.997722</td>\n",
       "      <td>5140.616348</td>\n",
       "      <td>404.381379</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>21.381455</td>\n",
       "      <td>67.929692</td>\n",
       "      <td>85.816328</td>\n",
       "      <td>108.583022</td>\n",
       "      <td>78.4225</td>\n",
       "      <td>82.4475</td>\n",
       "      <td>76.4975</td>\n",
       "      <td>82.923395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>10</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>257.76</td>\n",
       "      <td>416.416164</td>\n",
       "      <td>5153.132339</td>\n",
       "      <td>406.622834</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>21.149230</td>\n",
       "      <td>65.154321</td>\n",
       "      <td>88.940587</td>\n",
       "      <td>106.920036</td>\n",
       "      <td>79.8225</td>\n",
       "      <td>89.7625</td>\n",
       "      <td>78.6675</td>\n",
       "      <td>84.834281</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>11</td>\n",
       "      <td>1468</td>\n",
       "      <td>0.2520</td>\n",
       "      <td>0.3567</td>\n",
       "      <td>300.72</td>\n",
       "      <td>413.238197</td>\n",
       "      <td>5040.816106</td>\n",
       "      <td>405.871499</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>19.825106</td>\n",
       "      <td>64.852533</td>\n",
       "      <td>88.592409</td>\n",
       "      <td>102.805276</td>\n",
       "      <td>75.0975</td>\n",
       "      <td>89.3075</td>\n",
       "      <td>70.8625</td>\n",
       "      <td>81.423522</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>12</td>\n",
       "      <td>1468</td>\n",
       "      <td>0.2520</td>\n",
       "      <td>0.3567</td>\n",
       "      <td>257.76</td>\n",
       "      <td>414.913499</td>\n",
       "      <td>5036.044732</td>\n",
       "      <td>406.244274</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>19.766166</td>\n",
       "      <td>68.368734</td>\n",
       "      <td>90.733395</td>\n",
       "      <td>102.122676</td>\n",
       "      <td>76.2175</td>\n",
       "      <td>88.3625</td>\n",
       "      <td>79.6300</td>\n",
       "      <td>85.613241</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10451</th>\n",
       "      <td>2022/4/7 20:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>21</td>\n",
       "      <td>1462</td>\n",
       "      <td>0.1870</td>\n",
       "      <td>0.2015</td>\n",
       "      <td>284.20</td>\n",
       "      <td>421.215894</td>\n",
       "      <td>5455.090200</td>\n",
       "      <td>415.456502</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>23.866874</td>\n",
       "      <td>62.484755</td>\n",
       "      <td>57.702068</td>\n",
       "      <td>87.905487</td>\n",
       "      <td>78.5625</td>\n",
       "      <td>85.5275</td>\n",
       "      <td>73.0500</td>\n",
       "      <td>83.134051</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10452</th>\n",
       "      <td>2022/4/7 21:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>22</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.1898</td>\n",
       "      <td>0.2668</td>\n",
       "      <td>284.20</td>\n",
       "      <td>420.551847</td>\n",
       "      <td>5382.889380</td>\n",
       "      <td>415.444445</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.048841</td>\n",
       "      <td>63.383890</td>\n",
       "      <td>57.075895</td>\n",
       "      <td>87.070937</td>\n",
       "      <td>78.2125</td>\n",
       "      <td>82.5875</td>\n",
       "      <td>74.3275</td>\n",
       "      <td>83.501998</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10453</th>\n",
       "      <td>2022/4/7 22:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>23</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.2012</td>\n",
       "      <td>0.3207</td>\n",
       "      <td>324.80</td>\n",
       "      <td>421.545745</td>\n",
       "      <td>5351.422460</td>\n",
       "      <td>416.263289</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.160077</td>\n",
       "      <td>63.030310</td>\n",
       "      <td>56.857963</td>\n",
       "      <td>90.913126</td>\n",
       "      <td>76.4625</td>\n",
       "      <td>85.0900</td>\n",
       "      <td>71.9650</td>\n",
       "      <td>81.870114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10454</th>\n",
       "      <td>2022/4/7 23:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>24</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.2012</td>\n",
       "      <td>0.3207</td>\n",
       "      <td>284.20</td>\n",
       "      <td>419.824150</td>\n",
       "      <td>5367.476271</td>\n",
       "      <td>414.673827</td>\n",
       "      <td>...</td>\n",
       "      <td>50.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.588706</td>\n",
       "      <td>62.973828</td>\n",
       "      <td>56.737594</td>\n",
       "      <td>93.249515</td>\n",
       "      <td>78.2125</td>\n",
       "      <td>86.7525</td>\n",
       "      <td>74.6250</td>\n",
       "      <td>83.750104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10455</th>\n",
       "      <td>2022/4/8 0:00</td>\n",
       "      <td>2022/4/8</td>\n",
       "      <td>1</td>\n",
       "      <td>1465</td>\n",
       "      <td>0.2102</td>\n",
       "      <td>0.3177</td>\n",
       "      <td>283.71</td>\n",
       "      <td>421.984103</td>\n",
       "      <td>5422.489289</td>\n",
       "      <td>416.106559</td>\n",
       "      <td>...</td>\n",
       "      <td>50.0</td>\n",
       "      <td>261.0</td>\n",
       "      <td>25.645054</td>\n",
       "      <td>63.258180</td>\n",
       "      <td>57.772253</td>\n",
       "      <td>89.919792</td>\n",
       "      <td>78.4575</td>\n",
       "      <td>81.0825</td>\n",
       "      <td>73.2075</td>\n",
       "      <td>83.022638</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10456 rows × 59 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             DateTime      FDate  FHour  CG_LT_GL_GL04_Ftswd  CG_LT_GL_GL04_V  \\\n",
       "0             00:00.0  2020/8/21      8                 1473           0.2640   \n",
       "1             00:00.0  2020/8/21      9                 1473           0.2640   \n",
       "2             00:00.0  2020/8/21     10                 1473           0.2640   \n",
       "3             00:00.0  2020/8/21     11                 1468           0.2520   \n",
       "4             00:00.0  2020/8/21     12                 1468           0.2520   \n",
       "...               ...        ...    ...                  ...              ...   \n",
       "10451  2022/4/7 20:00   2022/4/7     21                 1462           0.1870   \n",
       "10452  2022/4/7 21:00   2022/4/7     22                 1450           0.1898   \n",
       "10453  2022/4/7 22:00   2022/4/7     23                 1450           0.2012   \n",
       "10454  2022/4/7 23:00   2022/4/7     24                 1450           0.2012   \n",
       "10455   2022/4/8 0:00   2022/4/8      1                 1465           0.2102   \n",
       "\n",
       "       CG_LT_GL_GL04_Si_Ti  CG_LT_GL_GL04_Fliluntie  CG_LT_GL_GL04_CWPRE  \\\n",
       "0                   0.2297                   260.52           408.577829   \n",
       "1                   0.2297                   257.76           413.997722   \n",
       "2                   0.2297                   257.76           416.416164   \n",
       "3                   0.3567                   300.72           413.238197   \n",
       "4                   0.3567                   257.76           414.913499   \n",
       "...                    ...                      ...                  ...   \n",
       "10451               0.2015                   284.20           421.215894   \n",
       "10452               0.2668                   284.20           420.551847   \n",
       "10453               0.3207                   324.80           421.545745   \n",
       "10454               0.3207                   284.20           419.824150   \n",
       "10455               0.3177                   283.71           421.984103   \n",
       "\n",
       "       CG_LT_GL_GL04_LFLL  CG_LT_GL_GL04_RFYL02  ...  CG_TQ_GL_GL04_TLZB  \\\n",
       "0             5052.245402            400.454975  ...                62.0   \n",
       "1             5140.616348            404.381379  ...                62.0   \n",
       "2             5153.132339            406.622834  ...                62.0   \n",
       "3             5040.816106            405.871499  ...                62.0   \n",
       "4             5036.044732            406.244274  ...                62.0   \n",
       "...                   ...                   ...  ...                 ...   \n",
       "10451         5455.090200            415.456502  ...                52.0   \n",
       "10452         5382.889380            415.444445  ...                52.0   \n",
       "10453         5351.422460            416.263289  ...                52.0   \n",
       "10454         5367.476271            414.673827  ...                50.0   \n",
       "10455         5422.489289            416.106559  ...                50.0   \n",
       "\n",
       "       CG_TQ_GL_GL04_DTHY  CG_LT_GL_GL04_ZBYCPJ  CG_LT_GL_GL04_19507WDPJ  \\\n",
       "0                   287.0             20.200611                70.602716   \n",
       "1                   287.0             21.381455                67.929692   \n",
       "2                   287.0             21.149230                65.154321   \n",
       "3                   287.0             19.825106                64.852533   \n",
       "4                   287.0             19.766166                68.368734   \n",
       "...                   ...                   ...                      ...   \n",
       "10451               271.0             23.866874                62.484755   \n",
       "10452               271.0             24.048841                63.383890   \n",
       "10453               271.0             24.160077                63.030310   \n",
       "10454               271.0             24.588706                62.973828   \n",
       "10455               261.0             25.645054                63.258180   \n",
       "\n",
       "       CG_LT_GL_GL04_26275WDPJ  CG_LT_GL_GL04_34800WDPJ  gaolu_score1  \\\n",
       "0                    89.131791               105.706944       75.5175   \n",
       "1                    85.816328               108.583022       78.4225   \n",
       "2                    88.940587               106.920036       79.8225   \n",
       "3                    88.592409               102.805276       75.0975   \n",
       "4                    90.733395               102.122676       76.2175   \n",
       "...                        ...                      ...           ...   \n",
       "10451                57.702068                87.905487       78.5625   \n",
       "10452                57.075895                87.070937       78.2125   \n",
       "10453                56.857963                90.913126       76.4625   \n",
       "10454                56.737594                93.249515       78.2125   \n",
       "10455                57.772253                89.919792       78.4575   \n",
       "\n",
       "       gaolu_score2  gaolu_score3  gaolu_score  \n",
       "0           83.2875       75.7275    82.684651  \n",
       "1           82.4475       76.4975    82.923395  \n",
       "2           89.7625       78.6675    84.834281  \n",
       "3           89.3075       70.8625    81.423522  \n",
       "4           88.3625       79.6300    85.613241  \n",
       "...             ...           ...          ...  \n",
       "10451       85.5275       73.0500    83.134051  \n",
       "10452       82.5875       74.3275    83.501998  \n",
       "10453       85.0900       71.9650    81.870114  \n",
       "10454       86.7525       74.6250    83.750104  \n",
       "10455       81.0825       73.2075    83.022638  \n",
       "\n",
       "[10456 rows x 59 columns]"
      ]
     },
     "execution_count": 163,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "###经济指标指标整体权重表\n",
    "key_param_weight = dict(\n",
    "               CG_LT_GL_GL04_V=0.05, \n",
    "               CG_LT_GL_GL04_Si_Ti=0.05,\n",
    "               CG_LT_GL_GL04_FCoalRate=0.2,\n",
    "               CG_LT_GL_GL04_FCokeRate=0.25,\n",
    "               CG_LT_GL_GL04_Fliluntie=0.45)\n",
    "\n",
    "\n",
    "# 获取子分数函数\n",
    "def get_sub_score(score_dict, param, value):\n",
    "    ld = score_dict[param]\n",
    "    for interval in ld.keys():\n",
    "        if value in interval:\n",
    "            return ld[interval]\n",
    "    return 65.0\n",
    "\n",
    "# 获取整体分数函数\n",
    "def get_score(score_dict, value_dict, param_weight):\n",
    "    score = 0\n",
    "    for k in value_dict.keys():\n",
    "        score += get_sub_score(score_dict, k, value_dict[k])*param_weight[k]\n",
    "    return score\n",
    "#整体分数生成\n",
    "df['gaolu_score3']= df.apply(lambda x: \\\n",
    "                      get_score(score_dict, \\\n",
    "                                dict(\n",
    "                                    CG_LT_GL_GL04_V=x['CG_LT_GL_GL04_V'],\n",
    "                                    CG_LT_GL_GL04_FCoalRate=x['CG_LT_GL_GL04_FCoalRate'],\n",
    "                                    CG_LT_GL_GL04_FCokeRate=x['CG_LT_GL_GL04_FCokeRate'],\n",
    "                                    CG_LT_GL_GL04_Si_Ti=x['CG_LT_GL_GL04_Si_Ti'],\n",
    "                                    CG_LT_GL_GL04_Fliluntie=x['CG_LT_GL_GL04_Fliluntie']), \\\n",
    "                                key_param_weight), axis= 1)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DateTime</th>\n",
       "      <th>FDate</th>\n",
       "      <th>FHour</th>\n",
       "      <th>CG_LT_GL_GL04_Ftswd</th>\n",
       "      <th>CG_LT_GL_GL04_V</th>\n",
       "      <th>CG_LT_GL_GL04_Si_Ti</th>\n",
       "      <th>CG_LT_GL_GL04_Fliluntie</th>\n",
       "      <th>CG_LT_GL_GL04_CWPRE</th>\n",
       "      <th>CG_LT_GL_GL04_LFLL</th>\n",
       "      <th>CG_LT_GL_GL04_RFYL02</th>\n",
       "      <th>...</th>\n",
       "      <th>CG_TQ_GL_GL04_TLZB</th>\n",
       "      <th>CG_TQ_GL_GL04_DTHY</th>\n",
       "      <th>CG_LT_GL_GL04_ZBYCPJ</th>\n",
       "      <th>CG_LT_GL_GL04_19507WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_26275WDPJ</th>\n",
       "      <th>CG_LT_GL_GL04_34800WDPJ</th>\n",
       "      <th>gaolu_score1</th>\n",
       "      <th>gaolu_score2</th>\n",
       "      <th>gaolu_score3</th>\n",
       "      <th>gaolu_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>8</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>260.52</td>\n",
       "      <td>408.577829</td>\n",
       "      <td>5052.245402</td>\n",
       "      <td>400.454975</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>20.200611</td>\n",
       "      <td>70.602716</td>\n",
       "      <td>89.131791</td>\n",
       "      <td>105.706944</td>\n",
       "      <td>75.5175</td>\n",
       "      <td>83.2875</td>\n",
       "      <td>75.7275</td>\n",
       "      <td>82.545150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>9</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>257.76</td>\n",
       "      <td>413.997722</td>\n",
       "      <td>5140.616348</td>\n",
       "      <td>404.381379</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>21.381455</td>\n",
       "      <td>67.929692</td>\n",
       "      <td>85.816328</td>\n",
       "      <td>108.583022</td>\n",
       "      <td>78.4225</td>\n",
       "      <td>82.4475</td>\n",
       "      <td>76.4975</td>\n",
       "      <td>84.052513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>10</td>\n",
       "      <td>1473</td>\n",
       "      <td>0.2640</td>\n",
       "      <td>0.2297</td>\n",
       "      <td>257.76</td>\n",
       "      <td>416.416164</td>\n",
       "      <td>5153.132339</td>\n",
       "      <td>406.622834</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>21.149230</td>\n",
       "      <td>65.154321</td>\n",
       "      <td>88.940587</td>\n",
       "      <td>106.920036</td>\n",
       "      <td>79.8225</td>\n",
       "      <td>89.7625</td>\n",
       "      <td>78.6675</td>\n",
       "      <td>87.104688</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>11</td>\n",
       "      <td>1468</td>\n",
       "      <td>0.2520</td>\n",
       "      <td>0.3567</td>\n",
       "      <td>300.72</td>\n",
       "      <td>413.238197</td>\n",
       "      <td>5040.816106</td>\n",
       "      <td>405.871499</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>19.825106</td>\n",
       "      <td>64.852533</td>\n",
       "      <td>88.592409</td>\n",
       "      <td>102.805276</td>\n",
       "      <td>75.0975</td>\n",
       "      <td>89.3075</td>\n",
       "      <td>70.8625</td>\n",
       "      <td>81.809257</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>00:00.0</td>\n",
       "      <td>2020/8/21</td>\n",
       "      <td>12</td>\n",
       "      <td>1468</td>\n",
       "      <td>0.2520</td>\n",
       "      <td>0.3567</td>\n",
       "      <td>257.76</td>\n",
       "      <td>414.913499</td>\n",
       "      <td>5036.044732</td>\n",
       "      <td>406.244274</td>\n",
       "      <td>...</td>\n",
       "      <td>62.0</td>\n",
       "      <td>287.0</td>\n",
       "      <td>19.766166</td>\n",
       "      <td>68.368734</td>\n",
       "      <td>90.733395</td>\n",
       "      <td>102.122676</td>\n",
       "      <td>76.2175</td>\n",
       "      <td>88.3625</td>\n",
       "      <td>79.6300</td>\n",
       "      <td>85.429736</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10451</th>\n",
       "      <td>2022/4/7 20:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>21</td>\n",
       "      <td>1462</td>\n",
       "      <td>0.1870</td>\n",
       "      <td>0.2015</td>\n",
       "      <td>284.20</td>\n",
       "      <td>421.215894</td>\n",
       "      <td>5455.090200</td>\n",
       "      <td>415.456502</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>23.866874</td>\n",
       "      <td>62.484755</td>\n",
       "      <td>57.702068</td>\n",
       "      <td>87.905487</td>\n",
       "      <td>78.5625</td>\n",
       "      <td>85.5275</td>\n",
       "      <td>73.0500</td>\n",
       "      <td>83.487954</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10452</th>\n",
       "      <td>2022/4/7 21:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>22</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.1898</td>\n",
       "      <td>0.2668</td>\n",
       "      <td>284.20</td>\n",
       "      <td>420.551847</td>\n",
       "      <td>5382.889380</td>\n",
       "      <td>415.444445</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.048841</td>\n",
       "      <td>63.383890</td>\n",
       "      <td>57.075895</td>\n",
       "      <td>87.070937</td>\n",
       "      <td>78.2125</td>\n",
       "      <td>82.5875</td>\n",
       "      <td>74.3275</td>\n",
       "      <td>83.168693</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10453</th>\n",
       "      <td>2022/4/7 22:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>23</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.2012</td>\n",
       "      <td>0.3207</td>\n",
       "      <td>324.80</td>\n",
       "      <td>421.545745</td>\n",
       "      <td>5351.422460</td>\n",
       "      <td>416.263289</td>\n",
       "      <td>...</td>\n",
       "      <td>52.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.160077</td>\n",
       "      <td>63.030310</td>\n",
       "      <td>56.857963</td>\n",
       "      <td>90.913126</td>\n",
       "      <td>76.4625</td>\n",
       "      <td>85.0900</td>\n",
       "      <td>71.9650</td>\n",
       "      <td>81.976846</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10454</th>\n",
       "      <td>2022/4/7 23:00</td>\n",
       "      <td>2022/4/7</td>\n",
       "      <td>24</td>\n",
       "      <td>1450</td>\n",
       "      <td>0.2012</td>\n",
       "      <td>0.3207</td>\n",
       "      <td>284.20</td>\n",
       "      <td>419.824150</td>\n",
       "      <td>5367.476271</td>\n",
       "      <td>414.673827</td>\n",
       "      <td>...</td>\n",
       "      <td>50.0</td>\n",
       "      <td>271.0</td>\n",
       "      <td>24.588706</td>\n",
       "      <td>62.973828</td>\n",
       "      <td>56.737594</td>\n",
       "      <td>93.249515</td>\n",
       "      <td>78.2125</td>\n",
       "      <td>86.7525</td>\n",
       "      <td>74.6250</td>\n",
       "      <td>84.171416</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10455</th>\n",
       "      <td>2022/4/8 0:00</td>\n",
       "      <td>2022/4/8</td>\n",
       "      <td>1</td>\n",
       "      <td>1465</td>\n",
       "      <td>0.2102</td>\n",
       "      <td>0.3177</td>\n",
       "      <td>283.71</td>\n",
       "      <td>421.984103</td>\n",
       "      <td>5422.489289</td>\n",
       "      <td>416.106559</td>\n",
       "      <td>...</td>\n",
       "      <td>50.0</td>\n",
       "      <td>261.0</td>\n",
       "      <td>25.645054</td>\n",
       "      <td>63.258180</td>\n",
       "      <td>57.772253</td>\n",
       "      <td>89.919792</td>\n",
       "      <td>78.4575</td>\n",
       "      <td>81.0825</td>\n",
       "      <td>73.2075</td>\n",
       "      <td>82.545150</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10456 rows × 59 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             DateTime      FDate  FHour  CG_LT_GL_GL04_Ftswd  CG_LT_GL_GL04_V  \\\n",
       "0             00:00.0  2020/8/21      8                 1473           0.2640   \n",
       "1             00:00.0  2020/8/21      9                 1473           0.2640   \n",
       "2             00:00.0  2020/8/21     10                 1473           0.2640   \n",
       "3             00:00.0  2020/8/21     11                 1468           0.2520   \n",
       "4             00:00.0  2020/8/21     12                 1468           0.2520   \n",
       "...               ...        ...    ...                  ...              ...   \n",
       "10451  2022/4/7 20:00   2022/4/7     21                 1462           0.1870   \n",
       "10452  2022/4/7 21:00   2022/4/7     22                 1450           0.1898   \n",
       "10453  2022/4/7 22:00   2022/4/7     23                 1450           0.2012   \n",
       "10454  2022/4/7 23:00   2022/4/7     24                 1450           0.2012   \n",
       "10455   2022/4/8 0:00   2022/4/8      1                 1465           0.2102   \n",
       "\n",
       "       CG_LT_GL_GL04_Si_Ti  CG_LT_GL_GL04_Fliluntie  CG_LT_GL_GL04_CWPRE  \\\n",
       "0                   0.2297                   260.52           408.577829   \n",
       "1                   0.2297                   257.76           413.997722   \n",
       "2                   0.2297                   257.76           416.416164   \n",
       "3                   0.3567                   300.72           413.238197   \n",
       "4                   0.3567                   257.76           414.913499   \n",
       "...                    ...                      ...                  ...   \n",
       "10451               0.2015                   284.20           421.215894   \n",
       "10452               0.2668                   284.20           420.551847   \n",
       "10453               0.3207                   324.80           421.545745   \n",
       "10454               0.3207                   284.20           419.824150   \n",
       "10455               0.3177                   283.71           421.984103   \n",
       "\n",
       "       CG_LT_GL_GL04_LFLL  CG_LT_GL_GL04_RFYL02  ...  CG_TQ_GL_GL04_TLZB  \\\n",
       "0             5052.245402            400.454975  ...                62.0   \n",
       "1             5140.616348            404.381379  ...                62.0   \n",
       "2             5153.132339            406.622834  ...                62.0   \n",
       "3             5040.816106            405.871499  ...                62.0   \n",
       "4             5036.044732            406.244274  ...                62.0   \n",
       "...                   ...                   ...  ...                 ...   \n",
       "10451         5455.090200            415.456502  ...                52.0   \n",
       "10452         5382.889380            415.444445  ...                52.0   \n",
       "10453         5351.422460            416.263289  ...                52.0   \n",
       "10454         5367.476271            414.673827  ...                50.0   \n",
       "10455         5422.489289            416.106559  ...                50.0   \n",
       "\n",
       "       CG_TQ_GL_GL04_DTHY  CG_LT_GL_GL04_ZBYCPJ  CG_LT_GL_GL04_19507WDPJ  \\\n",
       "0                   287.0             20.200611                70.602716   \n",
       "1                   287.0             21.381455                67.929692   \n",
       "2                   287.0             21.149230                65.154321   \n",
       "3                   287.0             19.825106                64.852533   \n",
       "4                   287.0             19.766166                68.368734   \n",
       "...                   ...                   ...                      ...   \n",
       "10451               271.0             23.866874                62.484755   \n",
       "10452               271.0             24.048841                63.383890   \n",
       "10453               271.0             24.160077                63.030310   \n",
       "10454               271.0             24.588706                62.973828   \n",
       "10455               261.0             25.645054                63.258180   \n",
       "\n",
       "       CG_LT_GL_GL04_26275WDPJ  CG_LT_GL_GL04_34800WDPJ  gaolu_score1  \\\n",
       "0                    89.131791               105.706944       75.5175   \n",
       "1                    85.816328               108.583022       78.4225   \n",
       "2                    88.940587               106.920036       79.8225   \n",
       "3                    88.592409               102.805276       75.0975   \n",
       "4                    90.733395               102.122676       76.2175   \n",
       "...                        ...                      ...           ...   \n",
       "10451                57.702068                87.905487       78.5625   \n",
       "10452                57.075895                87.070937       78.2125   \n",
       "10453                56.857963                90.913126       76.4625   \n",
       "10454                56.737594                93.249515       78.2125   \n",
       "10455                57.772253                89.919792       78.4575   \n",
       "\n",
       "       gaolu_score2  gaolu_score3  gaolu_score  \n",
       "0           83.2875       75.7275    82.545150  \n",
       "1           82.4475       76.4975    84.052513  \n",
       "2           89.7625       78.6675    87.104688  \n",
       "3           89.3075       70.8625    81.809257  \n",
       "4           88.3625       79.6300    85.429736  \n",
       "...             ...           ...          ...  \n",
       "10451       85.5275       73.0500    83.487954  \n",
       "10452       82.5875       74.3275    83.168693  \n",
       "10453       85.0900       71.9650    81.976846  \n",
       "10454       86.7525       74.6250    84.171416  \n",
       "10455       81.0825       73.2075    82.545150  \n",
       "\n",
       "[10456 rows x 59 columns]"
      ]
     },
     "execution_count": 164,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "###综合指标指标整体权重表\n",
    "#整体分数生成\n",
    "df['gaolu_score']= (df['gaolu_score1']*0.45+df['gaolu_score2']*0.2+df['gaolu_score3']*0.35)*1.07\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 165,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_csv('C:\\\\Users\\\\sijin\\\\Desktop\\\\打分更新2020\\\\20220707\\\\Dafen_socre20220708-4.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              FHour  CG_LT_GL_GL04_Ftswd  CG_LT_GL_GL04_V  \\\n",
      "count  10456.000000         10456.000000     10456.000000   \n",
      "mean      12.492540          1464.537969         0.233973   \n",
      "std        6.926791            12.892058         0.034262   \n",
      "min        1.000000          1169.000000         0.132700   \n",
      "25%        6.000000          1457.000000         0.196500   \n",
      "50%       12.000000          1465.000000         0.232500   \n",
      "75%       18.000000          1472.000000         0.261700   \n",
      "max       24.000000          1510.000000         0.367800   \n",
      "\n",
      "       CG_LT_GL_GL04_Si_Ti  CG_LT_GL_GL04_Fliluntie  CG_LT_GL_GL04_CWPRE  \\\n",
      "count         10456.000000              10456.00000         10456.000000   \n",
      "mean              0.322410                243.30038           386.956461   \n",
      "std               0.199218                 69.11228            98.232432   \n",
      "min               0.044000                  0.00000             0.226171   \n",
      "25%               0.205500                228.40250           408.354672   \n",
      "50%               0.279700                261.08000           421.769021   \n",
      "75%               0.371000                284.46000           426.383096   \n",
      "max               1.962400                379.60000           436.865065   \n",
      "\n",
      "       CG_LT_GL_GL04_LFLL  CG_LT_GL_GL04_RFYL02  CG_LT_GL_GL04_RFWD  \\\n",
      "count        10456.000000          10456.000000        10456.000000   \n",
      "mean          4707.936191            379.744821         1145.256348   \n",
      "std           1323.731634             97.054042           91.191420   \n",
      "min              0.000000              0.173606          673.409367   \n",
      "25%           4882.045863            399.500989         1149.020474   \n",
      "50%           5177.921941            414.716264         1168.911240   \n",
      "75%           5337.388711            418.946109         1179.892570   \n",
      "max           5806.708636            428.232004         1412.180433   \n",
      "\n",
      "       CG_LT_GL_GL04_LDYL  ...  CG_TQ_GL_GL04_TLZB  CG_TQ_GL_GL04_DTHY  \\\n",
      "count        10456.000000  ...        10456.000000        10456.000000   \n",
      "mean           219.372832  ...           60.611301          279.279839   \n",
      "std             59.131173  ...            8.113411           21.158839   \n",
      "min             -1.329568  ...            0.380000          236.000000   \n",
      "25%            234.800064  ...           58.000000          265.000000   \n",
      "50%            240.337796  ...           60.000000          276.000000   \n",
      "75%            244.506590  ...           63.000000          291.000000   \n",
      "max            250.387082  ...          274.000000          418.000000   \n",
      "\n",
      "       CG_LT_GL_GL04_ZBYCPJ  CG_LT_GL_GL04_19507WDPJ  CG_LT_GL_GL04_26275WDPJ  \\\n",
      "count          10456.000000             10456.000000             10456.000000   \n",
      "mean              22.286189                69.213910               116.103150   \n",
      "std                8.511898                11.283500                43.228280   \n",
      "min              -59.875229                36.513460                34.713580   \n",
      "25%               19.867409                61.816906                85.717987   \n",
      "50%               22.650646                67.487732               111.067007   \n",
      "75%               26.135408                75.382416               144.830379   \n",
      "max              178.928094               149.593397               351.316543   \n",
      "\n",
      "       CG_LT_GL_GL04_34800WDPJ  gaolu_score1  gaolu_score2  gaolu_score3  \\\n",
      "count             10456.000000  10456.000000  10456.000000  10456.000000   \n",
      "mean                116.417495     76.004605     77.199574     74.610740   \n",
      "std                  41.319617      5.260050      5.218771      5.293800   \n",
      "min                  40.056458     65.000000     65.000000     65.000000   \n",
      "25%                  92.971564     72.087500     73.925000     71.243125   \n",
      "50%                 106.615957     75.762500     77.145000     73.820000   \n",
      "75%                 131.389463     80.155000     80.417500     77.162500   \n",
      "max                 303.618234     90.550000     94.470000     93.262500   \n",
      "\n",
      "        gaolu_score  \n",
      "count  10456.000000  \n",
      "mean      81.058648  \n",
      "std        4.279510  \n",
      "min       69.728824  \n",
      "25%       78.283106  \n",
      "50%       81.024212  \n",
      "75%       84.053683  \n",
      "max       94.976678  \n",
      "\n",
      "[8 rows x 57 columns]\n"
     ]
    }
   ],
   "source": [
    "print(df.describe())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "#df.describe().to_csv('C:\\\\Users\\\\sijin\\\\Desktop\\\\打分更新2020\\\\Dafen_describe1.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
